Sunday, 15 February 2015

ajax - Why does jQuery insist my plain text is not "well-formed"? -


I am creating an AJAX call to get some plain text:

  $ . Ajax ({Url: "programData.txt", type: "GET", datatype: "text", cache: incorrect, success: process data});  

When I request, however, I get the following error:

Error: Not well created source file: file: // / Projects /foo/program.data.txt?_=1259694590361 Line: 1, Column: 2

Why jQuery is trying to process my plain text and how do I stop it ?

Are you loading HTTP in your browser on the page or just as a regular file Opening? Does the JavaScript page running address begin with http: or file:? I suspect that this is the latter, and Ajax works differently in that situation (see the response by tvanfonsson below) If you are building a web app that will later be served on HTTP, then the local HTTP server Try running your page using


No comments:

Post a Comment