javascript - how to get error message of failed ajax -


i want consume webservice json data from

    $.ajax({     type: 'get',     contenttype: 'application/json',     datatype: 'json-p',     //the url shows correct json data when copy url in browser     url: 'http://url.com',     success: function(data){         console.log(data);         alert(data);     },        error: function(xhr, teststatus, error){console.log("error occured: "+error+" "+xhr+" "+teststatus)} }) 

in firefox, calls error function, dont know problem is, great know error message approach doesnt work. in advance

edit: in chrome following error:

origin null not allowed access-control-allow-origin.

edit: it´s solved, problem indeed json doesnt work cross site, , data not "jsonp-conform" (it had set function(json data...))arround json data. done changing url @ end "_&jsonp=successcallback. sorry bothering you

i think there json object syntax error. check json object syntax error jsonlint.com.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -