Hi, I'm trying to make something very simple, but since I'm pretty new to JSONP, I'm struggling with it. All I want to do is get JSON from a text file in another domain (so I need to use JSONP to solve cross domain problems). I am using the following code:
$.ajax({ type: "GET", dataType: 'jsonp', url: "http://www.topshop.com/aboutus/show.txt", success: returnedMessage }); function returnedMessage(data) { console.log(data.message); }
I know that JSONP returns JSON as a function, but I don't know how to print the resulting json objects on the console. I am sure that this can be done, although, as I can see on the NET tab of Firebug, it returns JSON as an answer. In the Firebug console, I get an invalid tag message, which I think is due to the fact that I am not considering the JSONP request correctly. Can anyone help me with this?
source share