0

I am using this Xdomain.js file from https://gist.github.com/1114981

Here is my jquery ajax call to retrieve xml from cross domain,

$(document).ready(function () {
    $.ajax({
        type: "GET",
        url: "http://rxnav.nlm.nih.gov/REST/Ndfrt/search?conceptName=TESTOSTERONE",
        dataType: "xml",
        success: xmlParser

      });
});

function xmlParser(xml) { 
    $(xml).find("entry").each(function () {
        $(".entirecont").append($(this).find('inputConceptName').text());
    });
}

when i googled on this i got a solution i.e XDomainRequest object in IE but how do i make ajax call from this jquery plugin https://gist.github.com/1114981 to make cross domain calls work..

And, also i have imported this plugin from github https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest but when it seems that IE is throwing an error saying that ajaxTransport method doesn't support and i am currently using jquery 1.3.2

Murali N
  • 3,451
  • 4
  • 27
  • 38
  • Does that service support CORS? what version of IE are you testing with? Does that plugin support jQuery 1.3.2? jQuery.ajax was completely re-written in 1.5 which will affect the compatibility of that plugin between 1.5 and versions prior. – Kevin B Jan 28 '13 at 16:33
  • yes it supports CORS, i am currently using IE 9 – Murali N Jan 28 '13 at 16:39
  • That plugin was written in 2011, and jQuery 1.5 was released in January of 2011. My guess is that the plugin does not support your version of jQuery. – Kevin B Jan 28 '13 at 16:40
  • @kevin do you know any other plugin that does the cross domain work.. – Murali N Jan 28 '13 at 16:54
  • I do not, i would suggest instead using native javascript to send this request rather than jQuery. – Kevin B Jan 28 '13 at 16:55
  • For IE yes, but you'd still need to use the normal one for the other browsers. – Kevin B Jan 28 '13 at 16:57

2 Answers2

0

Instead of Xdomain.js, try including this file in your project:

https://github.com/intuit/xhr-xdr-adapter/blob/master/src/xhr-xdr-adapter.js

I tested it on IE 8 and IE 9 (the latter with both jQuery 1.x and 2.x), and it works for me. I was also able to get basic CORS to work with AngularJS on IE 8/9 when I included the xhr-xdr-adapter, which won't work with AngularJS otherwise (for example, when loading template files from a CDN.)

Lawrence
  • 4,909
  • 1
  • 15
  • 11
0

A simple way to work both XDomain Request in IE browsers we can use the simple example of XDomainRequest, in else condition we can write the normal ajax request to make sure that which will work in all the browsers.

by using the below example it worked for me http://msdn.microsoft.com/en-us/library/cc288060(VS.85).aspx#events