Receive XML response from Cross-Domain Ajax request with jQuery

后端 未结 1 846
清酒与你
清酒与你 2020-12-11 02:47

I trying to make an ajax request to another domain, it already works, but now I have another problem...

This is my code:

function getChannelMessages(         


        
相关标签:
1条回答
  • 2020-12-11 03:32

    The plain answer to my question is this: There are only two ways of do this:

    1. Use a proxy. I won't put here all the how-to's to make it, but you can find a lot of information in the web searching for "cors" "cross domains ajax requests" and "yql" (this last is a proxy by Yahoo)

    2. Use CORS. This is Cross-Origin Resource Sharing. That is: activate the server from which you want to get information to sent information to any other domain and to answer to requests from any other domain. To do this you must be the one who manage the server/service.

    Those two are the only ways of getting information XML (or any other format) from another domain. To make json cross domain requests:

    • Use jsonp (Json Padded). I won't explain this (and actually is just extra information since it won't work if the answer from the server is XML - my main problem), cause there is a lot of information on the web.

    Unfortunately I was not able to accomplished my goal, cause SQS is not configured to any of this methods... Still, I've got plenty insight of how Cross-Domains Requests works. And I hope this help anyone...

    0 讨论(0)
提交回复
热议问题