in reply to Call Perl script from Javascript

Hello Abed, i am imagining a kind of search field dropdown which auto fills as you type. Essentially you just need to direct the XHTMLrequest object to the Perl script. Using a CGI script to query the database with the use of database handles and statement handles and then creating a valid XHMTL object to return, which can then be appropriated by the Javascript into the DOM on receipt.

If you want a more specific answer you will need to provide some code

Replies are listed 'Best First'.
Re^2: Call Perl script from Javascript
by fattahsafa (Sexton) on Mar 19, 2014 at 21:29 UTC
    Hi, This is exactly what I'm doing :)..auto fill field Currently I have php script that does the db connection and return the data to the Javascript that post it to the html. My question: - I'm using the following Javacript function to call php
    $.get("suggest.pl", {word: $(this).val()}, function(data){ $("#myWord").empty(); $("#myWord").html(data); });
    gets the values from php (php is doing echo for the returned values from db) then post them to html. How can I replace this code to be valid to the perl scipt? Thanks,

      This JavaScript should work with tangent's answer below, did you try it?

      If you're having trouble with your Perl script feel free to post your code with any errors you are getting.

        Hi Tangent,all I tried the cgi just as you suggest, but didn't work. To be more clear, I did the following: - write perl script "suggest.pl" - Replace suggest.php in the jquery with suggest.pl
        $.get("suggest.pl", {word: $(this).val()},...
        did I miss sth?