iwan
iwan

Reputation: 7569

jQuery.POST truncate "data" value?

I am trying to use jQuery ajax library.

Everything is ok, except that the data is truncated. It will become only <soapenv:Envelope xmlns:soapenv:"http://schemas.xmlsoap.org/soap/envelope/" xmlns:asi (the rest is missing). Any idea?

//var soap contain as following

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:asi="http://siebel.com/asi/"><soapenv:Header/><soapenv:Body><asi:SiebelAccountQueryById>      <PrimaryRowId>3-2A2-3235</PrimaryRowId></asi:SiebelAccountQueryById></soapenv:Body></soapenv:Envelope>

jQuery.ajax({
  type: 'POST',
  url: url,
  data: soap,
  success: function() {
    console.log("success calling web service");
  },
  dataType: 'xml'
});

Further update I changed the soap value above at these attributes: xmlns:soapenv xmlns:asi to be something like 111="222" aaa="bbb"

It still get truncated at SECOND attributes. If I remove one of the attributes, none will get truncated, whole SOAP XML are sent.

Upvotes: 0

Views: 1863

Answers (3)

iwan
iwan

Reputation: 7569

Link given by Majid above solved my problem. There are AJAX attributes need to be set to indicated it is XML message. Then no longer truncation is happening

Not sure how to accept that as an answer.. since it is part of comment.

Upvotes: 0

Steve
Steve

Reputation: 1402

First thing I would do is put a couple of alert() popups in there. One after you set the variable, one when you call the function. Discover where it has and doesn't have the full string and keep tracing back so you can figure out why it is truncating.

Upvotes: 0

Gary Green
Gary Green

Reputation: 22395

Try escaping the data before posting:

jQuery.ajax({
  type: 'POST',
  url: url,
  data: encodeURIComponent(soap),
  success: function() {
    console.log("success calling web service");
  },
  dataType: 'xml'
});

Upvotes: 2

Related Questions