Why does my JSONP request give me Uncaught SyntaxError: Unexpected token < (less than)?

前端 未结 1 1873
清酒与你
清酒与你 2020-12-04 03:56

Following is my xmlfile

applica.luminoustec.net/file.xml

I need to access with this ajax call from my local host, all about is cross domain

相关标签:
1条回答
  • 2020-12-04 04:25

    http://applica.luminoustec.net/file.xml is XML.

    dataType: "jsonp", tells jQuery to parse it as JSONP.

    XML is not JSONP. Thus, it errors.

    Either:

    1. Change the URL to one which returns JSONP or
    2. Remove the dataType line and let jQuery detect it as XML (NB: This will probably require that you set up CORS support on the server).
    0 讨论(0)
提交回复
热议问题