Getting Cross-site XML response with jquery

I'm trying to get some xml information from a service that is not mine. Basically, the user will authenticate on the other service and my script should go get the information using it authentication cookie via cross-site.

I'm using jquery to do that, and I can see that the response I want to process is returned by the service (via firebug), the thing is that I'm using jsonp to do the call, so jquery returns a parsing error.

I've tried all the solutions that I encountered to do this kind of operation, like YQL and proxy server.

My frustration in here is that I'm seeing the response I want but jquery just don't give me the raw information.

I know that I'm calling a function that expects json response, but isn't any workaround or other way to this? like xmlp xD.

            url: "serviceurl",

            dataType: 'jsonp', //I've tried 'jsonp xml'

            crossDomain: true,
            xhrFields: {
                withCredentials: true
            success: function()
                alert('Load was performed.');

            error: function(jqxhr,error) 


EDIT: Here is the output from the server

   <name> Scrobbler</name>




It simply isn't possible to request XML from a cross-domain source unless the other domain supports CORS.

You must use some sort of proxy such as YQL, as you have already mentioned.

The response you are seeing when you set the datatype to JSONP is inside of a <script> tag. For example, you are getting this:

<script src=""></script>

where note.xml is:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<body>Don't forget me this weekend!</body>

which will of course throw an error because it is not valid javascript.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.