JSON 応答からデータをロードするサンプル jQuery プラグインを開発しています。
理由はわかりませんが、成功メソッドを呼び出していません。.error() メソッドに行きます。誰でもこれについて私を助けることができますか?
http://www.technicalkeeda.com/demos/load_scroll_content
適切な JSON 応答を返します。
<script>
$(document).ready(function () {
var jqxhr = $.getJSON('http://www.technicalkeeda.com/demos/load_scroll_content', function(data) {
alert("success");
},"json").success(function() { alert("second success"); })
.error(function(xhr, testStatus, error) {
alert('Error' + xhr.status);
alert('Error' +xhr.response);
alert('Error' +xhr.responseText);
})
.complete(function() { alert("complete"); });
jqxhr.complete(function(){ alert("second complete"); });
});
</script>
サービスからの応答
[[{"EMPLOYEE_ID":"1","EMPLOYEE_NAME":"Yashwant Chavan"},{"EMPLOYEE_ID":"2","EMPLOYEE_NAME":"Mahesh Diwan"},{"EMPLOYEE_ID":"3","EMPLOYEE_NAME":"Rajesh Limaye"},{"EMPLOYEE_ID":"4","EMPLOYEE_NAME":"Pankaj Patil"}]]