Loading ...
Sorry, an error occurred while loading the content.

Connection Manager

Expand Messages
  • learningyui
    Hi Group, I am trying to make an AJAX call to a Perl script which returns XML using Perl s XML::Simple. When I run the Perl script directly from the command
    Message 1 of 14 , Jul 2, 2009
    • 0 Attachment
      Hi Group,

      I am trying to make an AJAX call to a Perl script which returns XML using Perl's XML::Simple.

      When I run the Perl script directly from the command line, everything works and I see the XML code which I posted below.

      However, I am getting nothing back on the webpage, and when I alert the (o.repsonseXML) to the screen, I get NULL.

      Any suggestions?

      The code is below:
      a) Sample XML returned by Perl
      b) The AJAX Call
      c) The Perl code


      a)

      <Data>
      <Fields>
      <Field1>3</Field1>
      <Field10>Name</Field10>
      <Field2>Email</Field2>
      <Field3>Phone</Field3>
      </Fields>
      </Data>


      b)

      var sURL = "../cgi-bin/Eric/GDFtoXML.pl";
      var callback = {success: success_handler, failure: failure_handler, timeout: 10000};


      function success_handler(o) {
      document.getElementById('content').innerHTML = o.responseXML;
      alert(o.responseXML);
      }


      function send_request() {
      var callback = { success:success_handler, failure:failure_handler, timeout: 10000 };
      YAHOO.util.Connect.asyncRequest('POST', sURL, callback);
      }


      c) Note: this uses XML::Simple from CPAN

      my $xml = $xs->XMLout(\%myHash, noattr => 1, RootName=>'Data');
      print "<?xml version='1.0' encoding='UTF-8'?>\n";
      print "$xml";
      return $xml;
    • Michael Cramer
      ... Try using Firebug in Firefox to see what s going on. If it were working properly you would see the request back to your server and a response with the XML.
      Message 2 of 14 , Jul 2, 2009
      • 0 Attachment
        --- In ydn-javascript@yahoogroups.com, "learningyui"
        > I am trying to make an AJAX call to a Perl script which returns XML using Perl's XML::Simple.
        >
        > When I run the Perl script directly from the command line, everything works and I see the XML code which I posted below.
        >
        > However, I am getting nothing back on the webpage, and when I alert the (o.repsonseXML) to the screen, I get NULL.

        Try using Firebug in Firefox to see what's going on. If it were working properly you would see the request back to your server and a response with the XML. If your URL is wrong, Firebug should show the 404. If you get a 200, but incorrect or missing data, you might be passing bad arguments to the script. If you see a 500, chances are your script is failing to set the appropriate headers (like "Content-type:").

        With Firebug you'll at least be able to see the transaction and any errors coming back from the server.

        http://getfirebug.com/

        --Mike
      • John Doe
        I am getting the proper response when looking at Firebug, and as for the headers: i am getting Content-Typetext/xml; which I believe is CORRECT. Any other
        Message 3 of 14 , Jul 2, 2009
        • 0 Attachment
          I am getting the proper response when looking at Firebug, and as for the headers: i am getting

          Content-Type text/xml;

          which I believe is CORRECT.

          Any other ideas?


          From: Michael Cramer <cramer@...>
          To: ydn-javascript@yahoogroups.com
          Sent: Thursday, July 2, 2009 11:14:37 AM
          Subject: [ydn-javascript] Re: Connection Manager

          --- In ydn-javascript@ yahoogroups. com, "learningyui"

          > I am trying to make an AJAX call to a Perl script which returns XML using Perl's XML::Simple.
          >
          > When I run the Perl script directly from the command line, everything works and I see the XML code which I posted below.
          >
          > However, I am getting nothing back on the webpage, and when I alert the (o.repsonseXML) to the screen, I get NULL.

          Try using Firebug in Firefox to see what's going on. If it were working properly you would see the request back to your server and a response with the XML. If your URL is wrong, Firebug should show the 404. If you get a 200, but incorrect or missing data, you might be passing bad arguments to the script. If you see a 500, chances are your script is failing to set the appropriate headers (like "Content-type: ").

          With Firebug you'll at least be able to see the transaction and any errors coming back from the server.

          http://getfirebug. com/

          --Mike


        • Michael Cramer
          ... Maybe try o.responseText instead of o.responseXML ? Also, console.log(o) might be helpful in your callbacks to see what YUI is getting back from the
          Message 4 of 14 , Jul 2, 2009
          • 0 Attachment
            On Thu, Jul 2, 2009 at 11:25 AM, John Doe<learningyui@...> wrote:
            > I am getting the proper response when looking at Firebug, and as for the
            > headers: i am getting
            >
            > Content-Type text/xml;
            >
            > which I believe is CORRECT.
            >
            > Any other ideas?

            Maybe try "o.responseText" instead of "o.responseXML"? Also,
            "console.log(o)" might be helpful in your callbacks to see what YUI is
            getting back from the request.

            --
            Mike Cramer
            http://www.webkist.com/
            215.769.2505 // AIM/Skype/Etc: MikeWebkist
          • John Doe
            I have tried the o.responseText and that does not really work for me - I am getting back only the most intenal leaves/data, no XML structure, and getting it
            Message 5 of 14 , Jul 2, 2009
            • 0 Attachment
              I have tried the o.responseText and that does not really work for me - I am getting back only the most intenal leaves/data, no XML structure, and getting it all back as one long and ugly string.

              I need to maintain the XML structure for later accessing of the data.

              I also get:



              From: Michael Cramer <cramer@...>
              To: ydn-javascript@yahoogroups.com
              Sent: Thursday, July 2, 2009 11:32:20 AM
              Subject: Re: [ydn-javascript] Re: Connection Manager

              On Thu, Jul 2, 2009 at 11:25 AM, John Doe<learningyui@ yahoo.com> wrote:
              > I am getting the proper response when looking at Firebug, and as for the
              > headers: i am getting
              >
              > Content-Type text/xml;
              >
              > which I believe is CORRECT.
              >
              > Any other ideas?

              Maybe try "o.responseText" instead of "o.responseXML" ? Also,
              "console.log( o)" might be helpful in your callbacks to see what YUI is
              getting back from the request.

              --
              Mike Cramer
              http://www.webkist. com/
              215.769.2505 // AIM/Skype/Etc: MikeWebkist


            • Satyam
              A single whitespace, otherwise invisible before the
              Message 6 of 14 , Jul 2, 2009
              • 0 Attachment
                A single whitespace, otherwise invisible before the <?xml declaration
                (which you don't show in the XML sample though it seems you are
                outputting from the code) will make it fail. The <?xml processing
                instruction should be the very first thing in the message and it has to
                be there. Browsers often strip it before processing because browsers
                are designed to be tolerant. JavaScript does not because it is up to
                you to decide what to do, whether to be tolerant or not. That means
                that those nasty whitespaces are often hard to see. Do something like

                alert('[' + o.responseText.replace(/\s/g,'.') ); to see if there is any
                such whitespace.

                Satyam


                John Doe escribió:
                >
                >
                > I am getting the proper response when looking at Firebug, and as for
                > the headers: i am getting
                >
                > Content-Type text/xml;
                >
                > which I believe is CORRECT.
                >
                > Any other ideas?
                >
                > ------------------------------------------------------------------------
                > *From:* Michael Cramer <cramer@...>
                > *To:* ydn-javascript@yahoogroups.com
                > *Sent:* Thursday, July 2, 2009 11:14:37 AM
                > *Subject:* [ydn-javascript] Re: Connection Manager
                >
                > --- In ydn-javascript@ yahoogroups. com
                > <mailto:ydn-javascript%40yahoogroups.com>, "learningyui"
                > > I am trying to make an AJAX call to a Perl script which returns XML
                > using Perl's XML::Simple.
                > >
                > > When I run the Perl script directly from the command line,
                > everything works and I see the XML code which I posted below.
                > >
                > > However, I am getting nothing back on the webpage, and when I alert
                > the (o.repsonseXML) to the screen, I get NULL.
                >
                > Try using Firebug in Firefox to see what's going on. If it were
                > working properly you would see the request back to your server and a
                > response with the XML. If your URL is wrong, Firebug should show the
                > 404. If you get a 200, but incorrect or missing data, you might be
                > passing bad arguments to the script. If you see a 500, chances are
                > your script is failing to set the appropriate headers (like
                > "Content-type: ").
                >
                > With Firebug you'll at least be able to see the transaction and any
                > errors coming back from the server.
                >
                > http://getfirebug. com/ <http://getfirebug.com/>
                >
                > --Mike
                >
                >
                >
                >
                >
                > ------------------------------------------------------------------------
                >
                >
                > No virus found in this incoming message.
                > Checked by AVG - www.avg.com
                > Version: 8.5.375 / Virus Database: 270.13.2/2214 - Release Date: 07/02/09 05:54:00
                >
                >
              • Singh, Amit IN BLR SISL
                Hi I am using YAHOO.example.container.wait panel. But when it appears All dropdown box es are becoming invisible. Any idea to fix it. Thanks
                Message 7 of 14 , Sep 9, 2009
                • 0 Attachment

                  Hi

                  I am using YAHOO.example.container.wait panel. But when it appears  

                  All dropdown boxes are becoming invisible.

                  Any idea to fix it.

                  Thanks

                   

                   

                   

                Your message has been successfully submitted and would be delivered to recipients shortly.