Php 未捕获类型错误:无法使用';在';操作员搜索';25';在里面
正在努力找出这个错误。我理解这与字符串不是JSON对象有关,但是我无法修复它Php 未捕获类型错误:无法使用';在';操作员搜索';25';在里面,php,jquery,ajax,Php,Jquery,Ajax,正在努力找出这个错误。我理解这与字符串不是JSON对象有关,但是我无法修复它 Uncaught TypeError: Cannot use 'in' operator to search for '25' in ["fgdf","dfergerg","Save"] 这是我的职责: $(document).ready(function(){ $(".userIcon").click(function() { var groupUsername = $(this).
Uncaught TypeError: Cannot use 'in' operator to search for '25' in ["fgdf","dfergerg","Save"]
这是我的职责:
$(document).ready(function(){
$(".userIcon").click(function() {
var groupUsername = $(this).attr('id');
$.ajax({
type: "POST",
url: "groupUserList.php",
data:{"groupUsername" : groupUsername},
}).done(function(data) {
jQuery.each(data, function(name, value) {
if (value !== 'Save')
{
$(document).ready(function(){
console.log(value);
})
}
})
})
})
})
干杯把它整理好了。只是缺少数据类型
dataType: "json",
首先检查PHP,它显示了什么?第二个$(document)ready相当无用,因为在调用ajax的
done
处理程序时dom已经加载。您确定数据是对象而不是字符串吗?尝试使用console.log(“type:”,typeof(data))
或console.log(data)
听起来类似于,一种修复方法是将响应头从php显式设置为application/json