我從jquery ajax返回一些值。我得到的結果,但與此我也收到錯誤。請首先是看看代碼在jquery ajax中獲取錯誤「函數未定義」
function get_CommentCount(handleData) {
$.ajax({
url: 'Profile/get_CommentCount',
type: "post",
dataType: 'json',
success: function(data) {
handleData(data);
}
});
}
調用這樣
get_CommentCount(function(output) {
console.log('output', output)
});
它的這個功能給我的錯誤TypeError: handleData is not a function
。請有人告訴我爲什麼我得到這個錯誤。我已經通過了stackoverflow的問題,但我沒有找到任何解決方案。可能你會發現它重複,但我衝浪了stackoverflow後發佈這個問題。
感謝
顯示代碼,你在哪裏調用get_CommentCount –
你在哪裏添加了handleData函數? –
@SurenSrapyan請檢查我更新了代碼 –