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

connection manager - responseText empty?

Expand Messages
  • Cathy Kenny
    I have this javascript: function foo() { var pID = document.getElementById( data[pID] ).value; var cObj = YAHOO.util.Connect.asyncRequest( GET ,
    Message 1 of 3 , Apr 28, 2006
    • 0 Attachment
      I have this javascript:

      function foo() {
      var pID = document.getElementById("data[pID]").value;
      var cObj = YAHOO.util.Connect.asyncRequest('GET',
      'get_data_yahoo.php?pID=' + pID, {

      success: function (response) {
      alert(response.responseText);
      },
      failure: function (response) {
      alert(response.statusText);
      }
      });
      }

      when it's run responseText appears empty. here's my php script:

      $q = "select title from pe_petitions where petitionID = $pID";
      $r = $mysql_query($q);
      $row = mysql_fetch_assoc($r);
      return $row['title'];

      I know the php script works as it will print out $row['title'] - and
      for the same reason I know the pID parameter is getting passed, AND I
      know the success function is run.

      but for the life of me I can't figure out what's happening to responseText

      what am I missing?
    • Ken Robinson
      ... To get anything to show up in the responseText it needs to be echoed, not returned. Ken
      Message 2 of 3 , Apr 28, 2006
      • 0 Attachment
        At 05:24 PM 4/28/2006, Cathy Kenny wrote (in part):

        >when it's run responseText appears empty. here's my php script:
        >
        >$q = "select title from pe_petitions where petitionID = $pID";
        >$r = $mysql_query($q);
        >$row = mysql_fetch_assoc($r);
        >return $row['title'];

        To get anything to show up in the responseText it needs to be echoed,
        not returned.

        Ken
      • Cathy Kenny
        stars.. I knew it was something stupidly easy :) thanks a buncho! cathy
        Message 3 of 3 , Apr 28, 2006
        • 0 Attachment
          stars.. I knew it was something stupidly easy :)

          thanks a buncho!

          cathy

          --- In ydn-javascript@yahoogroups.com, Ken Robinson <kenrbnsn@...> wrote:
          >
          > At 05:24 PM 4/28/2006, Cathy Kenny wrote (in part):
          >
          > >when it's run responseText appears empty. here's my php script:
          > >
          > >$q = "select title from pe_petitions where petitionID = $pID";
          > >$r = $mysql_query($q);
          > >$row = mysql_fetch_assoc($r);
          > >return $row['title'];
          >
          > To get anything to show up in the responseText it needs to be echoed,
          > not returned.
          >
          > Ken
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.