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

RE: [ydn-javascript] trouble with DataSource

Expand Messages
  • hengji.cui@bt.com
    Use IE to access http://server/GridDataTest.csp if IE can open the link using XML format correctly, then you may pay close
    Message 1 of 3 , Aug 18, 2008
    • 0 Attachment
      Use IE to access http://server/ GridDataTest. csp    
      if IE can open the link using XML format correctly,  then you may pay close attention to  your code.
      If not, correct your XML source data.

      Stanley Cui  | Senior Software Engineer

       


      From: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com] On Behalf Of dletobar
      Sent: 19 August 2008 05:45
      To: ydn-javascript@yahoogroups.com
      Subject: [ydn-javascript] trouble with DataSource

      I'm obviously doing something wrong here but I can't get this simple
      DataSource test to work. GridDataTest. csp does not use any paramters,
      its hardcoded just for this test.
      Any help would be much appreciated. Thanks.

      ///the following DOES work,
      var req = new XMLHttpRequest( );
      req.open("GET" ,'http://server/ GridDataTest. csp', false);
      req.send(null) ;
      alert(req.responseT ext)
      ///returns <root><row>< A>10</A>< B>20</B>< C>40</C>< /row></root>

      ///WHILE, the following triggers the failure callback
      var myDataSource= new
      YAHOO.util.DataSour ce('http://server/ GridDataTest. csp?',{
      responseType: YAHOO.util. DataSource. TYPE_XML} );
      myDataSource. responseSchema = {
      resultNode: "row",
      fields: ["A","B","C" ]
      };
      var oCallback = {
      success: function(oRequest, oResponse, oPayload) {
      alert("Hi " + oPayload + "! There are " +
      oResponse.results. length + " rows");
      },
      failure: function(oRequest, oResponse, oPayload) {
      alert(oResponse) ;
      alert("Hi " + oPayload + "! There were no rows found.");
      },
      scope: this,
      argument: "test"
      };

      myDataSource. sendRequest( 'Id=xxx', oCallback);
      };

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