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

Re: [ydn-javascript] Datatable Connection Post - Urgent Help

Expand Messages
  • Satyam
    That you set your call to asyncRequest to POST does not make it so. You have to place your post data in the fourth argument so that the XHR object can clearly
    Message 1 of 2 , Jul 2, 2008
      That you set your call to asyncRequest to POST does not make it so. You
      have to place your post data in the fourth argument so that the XHR
      object can clearly identify it and send it in the body of the request.
      If you just chain it into the URL, it will still suffer from the same
      length limitations of a GET request and will get truncated, confusing
      the server and generating an error or just quiting. Moreover, even if
      it does not exceed the maximum length allowed, a JSON encoded string is
      not safe to just pass as an URL argument, it still needs to be
      url-encoded (via escape or encodeURIComponent) before concatenating it
      into the URL.

      Satyam


      myworld100us wrote:
      > Folks ,
      >
      > I am getting a strange exception while passing JSON object from my
      > datatable to the server . I was ablt to add 7 rows after that I am not
      > able to add any row . I get this exception
      >
      > "Exception " : Unknown Name. I am not able to send the data to the
      > server .
      > Here is the Code Sample.
      >
      >
      > var rs = [];
      > for (var i = 0; i <
      > myDrugTable.getRecordSet().getLength();i++) {
      > rs.push(myDrugTable.getRecord(i).getData());
      >
      > }
      >
      >
      >
      > alert("testttttt");
      >
      > var regimenDrug = YAHOO.lang.JSON.stringify(rs);
      > alert("regimenDrug"+regimenDrug);
      >
      > regimenDrug = regimenDrug.replace(/&/g,"^");
      > alert(" 123 regimenDrug"+regimenDrug);
      > var qsNext = "?regimenDrug="+regimenDrug;
      > qsNext+= "®imenKey="+regKey;
      > alert("qsNext"+qsNext);
      > try
      > {
      > var xhrUrl = dlURL+"saveRegimenDrug.do";
      > var mycallback = {
      >
      > success : function(o) {
      > var dte = o.responseText;
      > alert('inside suc'+dte);
      >
      > },
      > failure : function(o) {
      > alert('inside fail'+o);
      > }
      > };
      > YAHOO.util.Connect.asyncRequest("POST", xhrUrl+qsNext, mycallback);
      >
      > }
      > catch(err)
      > {
      > alert('exception'+err.description);
      > }
      >
      >
      > The Request does not go to the server at all . So even Call back
      > Failure doesnt happen . I dont know how to debug this issue.
      >
      > The JSON object gets alerted correctly .
      >
      >
      >
      >
      >
      >
      >
      > ------------------------------------
      >
      > Yahoo! Groups Links
      >
      >
      >
      > ------------------------------------------------------------------------
      >
      >
      > No virus found in this incoming message.
      > Checked by AVG.
      > Version: 8.0.101 / Virus Database: 270.4.4/1530 - Release Date: 02/07/2008 8:05
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.