Wednesday 15 April 2015

javascript - Not able to get result from data.responseText in IE but working in other browser -


I am using the code snippet below to bring data from a certain WebAPI.

data.responseText works fine in Firefox but gives undefined in IEL

I have tried to use the data. The responses are JSN but it does not work in IE.

Please give me the solution of this.

This is the code that I am using.

  $ .ajax ({type: "GET", url: serviceUrl, contentType: "application / json", data: "{'Slid': '" + slidname + "'}" , Async: false, crossDomain: true, complete: function (warning ("hii"); warning (data.responseText);}});  

Which version of IE? If IE 9 or less, this issue can be your jQuery version - see.

Otherwise, you can try that the browser helps in formatting AJAX request data:

$ Ajax ({type: "GET", url: serviceUrl, contentType: "application / json", data: JSON.stringify ({"slid": slidname}) < / Strong> , async: false, crossDomain: true, complete: function {alert ("hii"); alert (data.responseText);}});

If this also fails, you can try "jsonp" as the type of data for AJAX calls because you have a cross-domain request.

$ Type the data: "URL: service URL, content type:" Application / Jason ", data: JSN.trinfase ({ "Slid": slidname}), "jsonp" , complete: fun ction (data) {warning ("hii"); warning (data.responseText);}}); < / Code>


No comments:

Post a Comment