Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は次のコードを持っています
jQuery.getJSON(encodeURI(strUrl), {address:address,state:state, zip:zip},function(data){ alert('HELLO World!'); });
何らかの理由でstrUrlがJSON形式ではない文字列を返す場合、コールバック関数は呼び出されません。応答がjson形式であるかどうか、または投稿で問題が発生したかどうかを知る方法はありますか?
jQuery.getJSON doesn't allow you to define an error callback function.
jQuery.getJSON
You'll need to use jQuery.ajax instead, setting the dataType to json and set the remaining configuration variables as getJSON defines by default.
jQuery.ajax
dataType
json