Make a Cross-Domain request for XML from a local file

前端 未结 2 1096
你的背包
你的背包 2021-01-22 09:35

I am not sure if this is even possible. Basically I want to load a local html file on a client PC and have it make a request to a remote server. The data served up by the server

相关标签:
2条回答
  • 2021-01-22 10:24

    Regardless of payload type JSON or XML what you are doing is JSONP and the result is a javascript function call. So the response must be a valid javascript function call with XML data as input to that function.

    0 讨论(0)
  • 2021-01-22 10:33

    Well, if you are having a problem with the cross domain policy, you might need to build some sort of proxy that will do the request for you. (Its pretty simple to make)

    If you want to open a JavaScript file to make an Ajax request I'd use Dojo to parse the XML.

    You have a nice example here: http://dojotoolkit.org/reference-guide/dojo/xhrGet.html

    Hope it helps.

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