I’m trying to read url using getJson. It doesn’t fire neither the success function nor the error one.
var url = "http://demo.dreamacc.com/TextTable.json?callback=?";
$.ajax({
type: 'GET',
url: url,
async: false,
jsonpCallback: 'jsonCallback',
contentType: "application/json",
dataType: 'jsonp',
success: function (ooo) {
alert('hi');
alert(ooo);
},
error: function () {
alert('w');
}
});
but when I’m trying to read this url
http://api.twitter.com/1/statuses/user_timeline/codinghorror.json?callback=?
it works well
The endpoint (your requested URL, http://demo.dreamacc.com/TextTable.json) doesn’t support JSONP returns.
You will not be able to retrieve data from this website using a JSONP request.
JSONP works by specifying to the remote server to wrap the JSON object within a function call (function name defined via the
callbackGET parameter). If the endpoint doesn’t support this and modify its response appropriately, you will not be able to retrieve data from that site using JSONP.Examples:
Twitter (Supports JSONP): [ Normal JSON | JSONP ]
demo.dreamacc (Doesn’t support JSONP): [ Normal JSON | JSONP that doesn’t work ]
As you can see, the demo.dreamacc.com endpoint doesn’t wrap the response within a function call.