Javascript 发送参数作为响应-为什么不来?
最近我发现JS中的参数列表是这样发送到另一个函数的——我错了吗Javascript 发送参数作为响应-为什么不来?,javascript,jquery,Javascript,Jquery,最近我发现JS中的参数列表是这样发送到另一个函数的——我错了吗 func(parameters.response.items) 代码 整个项目可在 浏览器控制台中出现错误TypeError:friends[1]未定义 但是console.log()正确、完整地打印了所有内容访问了您的站点,并很快进行了检查 来自AJAX调用的数据出现错误 jQuery33105943325674648605_1558658520581({"error":{"error_code":5,"error_msg":"
func(parameters.response.items)
代码
整个项目可在
浏览器控制台中出现错误TypeError:friends[1]未定义
但是
console.log()
正确、完整地打印了所有内容访问了您的站点,并很快进行了检查
来自AJAX调用的数据出现错误
jQuery33105943325674648605_1558658520581({"error":{"error_code":5,"error_msg":"User authorization failed: access_token was given to another ip address.","request_params":[{"key":"oauth","value":"1"},{"key":"method","value":"friends.get"},{"key":"fields","value":"photo_100"},{"key":"count","value":"5"},{"key":"v","value":"5.95"},{"key":"callback","value":"jQuery33105943325674648605_1558658520581"},{"key":"_","value":"1558658520582"}]}});
首先检查错误:
Request('friends.get', {fields: 'photo_100', count: 5, v: 5.95}, function(data) {
if(!data.error) {
//console.log(data);
if(data.response.items) {
Draw(data.response.items);
} else {
console.log("Unexpected json object format.");
}
} else {
alert(data.error.error_msg);
}
});
去了你的网站,很快就查到了 来自AJAX调用的数据出现错误
jQuery33105943325674648605_1558658520581({"error":{"error_code":5,"error_msg":"User authorization failed: access_token was given to another ip address.","request_params":[{"key":"oauth","value":"1"},{"key":"method","value":"friends.get"},{"key":"fields","value":"photo_100"},{"key":"count","value":"5"},{"key":"v","value":"5.95"},{"key":"callback","value":"jQuery33105943325674648605_1558658520581"},{"key":"_","value":"1558658520582"}]}});
首先检查错误:
Request('friends.get', {fields: 'photo_100', count: 5, v: 5.95}, function(data) {
if(!data.error) {
//console.log(data);
if(data.response.items) {
Draw(data.response.items);
} else {
console.log("Unexpected json object format.");
}
} else {
alert(data.error.error_msg);
}
});
这是一个免费的托管站点,因为返回的json是一个带有一个键的对象。以及它的错误。在尝试在#some.data(或至少是data.response.items)中添加html之前,请确保检查是否没有返回错误。数据示例
data.response.items
必须是数组,这是response
对象的属性,这是JSON数据
响应对象的属性,这是一个免费的托管站点,因为返回的json是一个带有一个键的对象。以及它的错误。在尝试在#some.data(或至少是data.response.items)中添加html之前,请确保检查是否没有返回错误。数据示例data.response.items
必须是数组,这是response
对象的属性,这是JSON数据
响应对象的属性,我很惊讶,bit控制台并没有捕捉到错误,即使您提出了两个位置。关于AJAX错误,我看不到这一点。你能去哪里?我很惊讶,bit控制台没有捕捉到错误,即使你提出了两个位置。关于AJAX错误,我看不到这一点。你能去哪里?