我想獲得此URL的響應。但是當我檢查控制檯出現錯誤信息時:未捕獲的類型錯誤:響應不是函數
Uncaught TypeError: response is not a function
可能出現什麼問題?
var uri = pbxApi+"/conference/participants/"+circle+"/"+data.conference+"/"+data.uniqueid+'?jsonp=response';
getJsonData(uri, function(res){
});
這是我的功能。
var getJsonData = function(uri,callback){
$.ajax({
type: "GET",
dataType: "jsonp",
url: uri,
jsonpCallback: 'response',
cache: false,
contentType: "application/json",
success: function(json){
callback(json);
}
});
}
這是我的迴應:
response({"_id":"56177d3b3f2dc8146bd8565c","event":"ConfbridgeJoin","channel":"SIP/192.168.236.15-0000005e","uniqueid":"1444379955.224","conference":"0090000293","calleridnum":"0090000290","calleridname":"0090000290","__v":0,"status":false,"sipSetting":{"accountcode":"0302150000","accountcode_naisen":"203","extentype":0,"extenrealname":"UID3","name":"0090000290","secret":"Myojyo42_f","username":"0090000290","context":"innercall_xdigit","gid":101,"cid":"0090000018"}})
檢查這一項http://stackoverflow.com/questions/32450690/show-some-error-uncaught-referenceerror – guradio
我已經聲明'jsonpCallback得到了回報數據:'響應','在我的代碼上。 – uno
只需提一下,'success:function(json){callback(json);如果我使用這個'success:callback(json)'而不是這個'success:function(json){callback(json);},則可以簡單地使用'success:callback(json)' –