Get Xml Data Cross-Domain with JQuery

10,254

Solution 1

You need to use JSONP.

Solution 2

No way to load XML. So yes, using "standard" xmlhttprequests you need JSONpadding.

If the server supports "Cross-Origin Resource Sharing (CORS)" you can easily receive data from a foreign domain. That means, you have to add a custom header into your XmlHttpRequest ('Origin') and the server decides if it does allow the request or not.

Share:
10,254
Dänu
Author by

Dänu

I'm Maharaja Bundy and women with 4 hooters feed me Ding Dongs all day

Updated on June 04, 2022

Comments

  • Dänu
    Dänu almost 2 years

    Is there a way to load XML Data Cross-Domain with JQuery (= client side)?

    $.get('http://otherdomain.com/data.xml', function(xml) { }
    

    The above doesn't work - do I have to rely on JSONP, or is there a way to load XML?