Thursday, May 23, 2013

Error "No Transport" - with AJAX/jQuery

Back to my blog after sometime..

I developed a web application to call a remote API (done using EJB) using javascript. Using javascript the data will be requested from the server and the returned data will be displayed in the html page in my local browser. I was ready to deploy as the code worked fine in firefox, chrome and safari.. but found it is not working in Internet Explorer.. :(

I am getting the error AJAX error message mentioned above. AJAX code is not working.. :(
How to handle this..???

Add   jQuery.support.cors = true;    before jQuery.ajax

It is working now even in IE.. :)

This is due to an IE cross domain issue.  JQuery checks whether cross site scripting (XSS) is allowed, and IE under normal browser context blocks cross site scripting. Since it is partially controlled by jQuery.support.cors, with the above tweak we can fix the issue. Thus, XSS is enabled for jQuery.

Reference:
http://mike-ward.net/blog/post/00660/force-jquery-1-5-to-always-allow-cross-site-scripting

No comments:

Post a Comment