Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Call Perl script from Javascript

by tangent (Parson)
on Mar 19, 2014 at 22:55 UTC ( [id://1079014]=note: print w/replies, xml ) Need Help??


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

To see what you are getting back from your script add an alert() to your javascript:
$.get("suggest.pl", {word: $(this).val()}, function(data){ alert(data); $("#myWord").empty(); $("#myWord").html(data); });
You say earlier that you already have the script that deals with the db, so instead of the echo in PHP you just need print in Perl, something like:
print $q->header; while (my $row = $sth->fetchrow_hashref) { my $word = $row->{'crps_word'}; my $prob = $row->{'crps_probability'}; my $str = $prob."----".$word; print qq|<option value="$word">$str</option>|; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1079014]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-19 23:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found