Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: retrieving value from ajax call to cgi page

by thomas895 (Hermit)
on Jun 29, 2013 at 10:05 UTC ( #1041441=note: print w/ replies, xml ) Need Help??


in reply to retrieving value from ajax call to cgi page

"It is not printing". Mmm-hmm, okay, very well.
As in, you get an empty response? Or an error message of some kind?

Did you verify that your JavaScript actually works? I don't know much about (what looks like jQuery) that, but you should use a tool like Firebug or your browser's console to check that the correct request is being sent.

~Thomas~ 
"Excuse me for butting in, but I'm interrupt-driven..."


Comment on Re: retrieving value from ajax call to cgi page
Re^2: retrieving value from ajax call to cgi page
by gayu_justin (Novice) on Jun 29, 2013 at 10:16 UTC
    yeah, i have checked through the firebug and found that the values are passing and also i created a test page and check whether the ajax call is alerting the content of the page and found that, it is working.I think, the problem is with the method, that i use to take the value.

      Okay, let's assume that your javascript does indeed work, and that the problem lies with your script.
      In that case, we will need a more complete example of your code. Is the $cgi object in the current scope? Did you turn on strict and warnings?

      For now, try the following sample:

      #!/usr/bin/perl use strict; use warnings; use CGI::Carp qw(fatalsToBrowser); # not needed per se, but very usefu +l for debugging use CGI; my $cgi = new CGI(); print $cgi->header("text/javascript"); print "alert('", $cgi->param("value1") || "nothing", "');\n";
      ~Thomas~ 
      "Excuse me for butting in, but I'm interrupt-driven..."

        I have tried like this and found that , in the alert box provided in the ajax, the value is printing correctly. The value1 contains 4 values, in the alert box provided in ajax code, the following displays each time with each colunm value of the row.:

        <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head><title>Results</title> </head> <body> content-type: text/html Content-Type: text/javascript; charset=UTF-8 alert(' 6')
        ===================================
        <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head><title>Results</title> </head> <body> content-type: text/html Content-Type: text/javascript; charset=UTF-8 alert(' sawerr')
        =================================
        <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head><title>Results</title> </head> <body> content-type: text/html Content-Type: text/javascript; charset=UTF-8 alert(' qswertyqawe')
        ============================================
        <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head><title>Results</title> </head> <body> content-type: text/html Content-Type: text/javascript; charset=UTF-8 alert(' y')
        ===================================

        BUt in the browser, it is showing like : charset=UTF-8 alert('nothing')

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2014-12-21 06:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (104 votes), past polls