javascript - Using ajax to read text data from an outside source -
so working on allow me read json data outside server, , print out in more human-readable format. far have this:
var address = "example.com"; //not actual site $.ajax({ url: address, datatype: "jsonp", success: function(data) { var obj = json.parse(data); //misc printing code goes here }, error: alert("error") });
however, consistently receiving error alert.
console tells me "unexpected token &". looking @ few other sources, issue seems actual data present on site nothing more raw text.
changed datatype field "text" try , fix this, console error instead changed tell me wasn't allowed access.
tried retrieving data , treating text "jsonp text", returned previous "unexpected token &" error.
there way can receive text data outside server? if not, there workaround use, such saving data document , importing code there?
Comments
Post a Comment