I have programming a Jquery Mobile application and I use an ajax request (method $.ajax(config)) to get my data. Well when I use tha value "json" in the "dataType" property, I have an error javascript which tell me "Non-Access-Control-Orogin" in the header. And when I use the value "jsonp" in the "dataType" property I have the response from the server but I get an error in the Json of response. "Unexpected token: :". Any advice to resolve this problem?
This is the URL to connect my server: http://rete.mywebsite.com/api3.0?param1=value1¶m2=value2
This is my code to get the data in the Json format: (Pardon the uncorrect tab)
$.ajax({ url: MY_URL, dataType: "jsonp", contentType: "application/json", crossDomain: true, success: function(response) { console.log(response); } });
The json how I should get is similar this: { "stazione_1":{ "name": "Brescia", "temperature": "7.5", ... } }
But I get the unexpected token error in the console javascript of the browser (I use Chrome)...
I hope this will been of help...