sushmas.sharma has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I have a perl page where I am using the jQuery autocompleter. I am calling another perl script which generates json output. The page works but not all the time. Here are my scripts.
index.pl
searchbyname.pl<script type="text/javascript" src="/xyz/jquery/js/jquery-1.7.1.min +.js"></script> <script type="text/javascript" src="/xyz/jquery/js/jquery-ui-1.8.17 +.custom.min.js"></script> <script type="text/javascript"> \$(document).ready(function(){ var byname = { source: "searchbyname.pl", select: function(event, ui){ \$("#cn").val(ui.item.cn); \$("#xyzid").val(ui.item.xyzid); \$("#xyzuid").val(ui.item.xyzuid); \$("#mail").val(ui.item.mail); }, minLength:2 }; \$("#cn").autocomplete(byname); } </script> <input type="text" name="cn" id="cn" value="$cn" size="40" maxlength=" +128" onClick="clearForm();" />
When I check the web console in firefox, the output is as follows:my @query_output; # LOOP THROUGH RESULTS while ( my $row = $sth->fetchrow_hashref ){ push @query_output, $row; } my $json = JSON::to_json(\@query_output); &log("I am in search by name page looking for $inpstr returning $json + "); print $json;
I start the search with string batt, The first line where is shows the status as 200 OK, the auto completer shows up with the results, even if it is complaining in the next line about the syntax of the json. then I press next letter e and the autocompleter does not come up. the firefox console shows the request/response in the third line and it says undefined. I am printing the json passed to index.pl in the log and the output is there and I validated the output online and it comes back as valid json. I have no idea, what am I doing wrong. please help. Thanks, Sushma[17:08:56.206] GET http://server.xyz.com/xyz/cgi-bin/searchbyname.pl?t +erm=batt [HTTP/1.1 200 OK 375ms] [17:08:56.579] syntax error @ http://server.xyz.com/xyz/cgi-bin/search +byname.pl?term=batt:1 [17:08:57.830] GET http://server.xyz.com/xyz/cgi-bin/searchbyname.pl?t +erm=batte [undefined 375ms]
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: perl jquery script returns http status undefined sometimes
by derby (Abbot) on Aug 21, 2012 at 22:13 UTC | |
Re: perl jquery script returns http status undefined sometimes
by Anonymous Monk on Aug 21, 2012 at 21:26 UTC |
Back to
Seekers of Perl Wisdom