0

I need to make a request to a dedicate website , using jsonp for cross domain reason to get back a XML result and work on it. So basicly I am doing this to start :

(function($) {
var url = 'http://www.website.....';
$.ajax({
   type: 'GET',
    url: url,
   // async: false,
   // contentType: "application/json",
dataType: 'jsonp',
});
})(jQuery);

I can finally get an answer from website, that I can see in the firebug plugin, but in XML tab such as :

<Results xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xsi:noNamespaceSchemaLocation="http://www.website.com">
<ResultSet id="searchResults" numResults="3" >

From my understanding jsonp is a json object and in my case it s returning a XML content.

My problem is how to manage the XML return from the website? I can parse it and play with in the javascript code.

Buhake Sindi
  • 87,898
  • 29
  • 167
  • 228
niko
  • 1
  • try adding callback in ajax options – Rahul Dec 23 '14 at 08:37
  • I don't think `$.ajax` will accept xml in a `jsonp` request. It is basically a script request where the response is a function call. That won't eval xml well I don't think. Suggest you just use a proxy – charlietfl Dec 23 '14 at 08:51
  • possible duplicate of [How to Parse XML Cross-domain in jQuery?](http://stackoverflow.com/questions/10068963/how-to-parse-xml-cross-domain-in-jquery) – Sariq Shaikh Dec 23 '14 at 09:46

1 Answers1

0

You need to define your jsonpcallback in order to tinker with the return value of the request.

See:

jsonpCallback function not working

http://api.jquery.com/jquery.ajax/

Community
  • 1
  • 1
John
  • 91
  • 4