0

私は次のコードを持っています

jQuery.getJSON(encodeURI(strUrl), {address:address,state:state, zip:zip},function(data){
    alert('HELLO World!');
});

何らかの理由でstrUrlがJSON形式ではない文字列を返す場合、コールバック関数は呼び出されません。応答がjson形式であるかどうか、または投稿で問題が発生したかどうかを知る方法はありますか?

4

1 に答える 1

1

jQuery.getJSON doesn't allow you to define an error callback function.

You'll need to use jQuery.ajax instead, setting the dataType to json and set the remaining configuration variables as getJSON defines by default.

于 2010-06-17T17:22:14.800 に答える