in reply to Re: Call Perl script from Javascript
in thread Call Perl script from Javascript

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,

Replies are listed 'Best First'.
Re^3: Call Perl script from Javascript
by Anonymous Monk on Mar 19, 2014 at 21:46 UTC

    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?
        did I miss sth?

        Yes. Read the parent again:

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

        The amount of help you get is usually proportional to the amount of effort you show.