jQuery失败,“operand obj”中的“TypeError:invalid” [英] jQuery fails with "TypeError: invalid 'in' operand obj"

查看:52
本文介绍了jQuery失败,“operand obj”中的“TypeError:invalid”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试运行此脚本时出现此错误...请帮助





TypeError:'in'operand obj中无效//当我查看控制台时







 $。 ajax({
url:' jen.php'
datatype:< span class =code-string>' json'
jsonp:' jsoncallback'
timeout: 5000
成功: function (数据,状态){
$(' # sch')。empty();
alert(' ');

$ .each(data, function (index,item){
var rept = < span class =code-string>' < li>' + item.id + ' < / li>';
$(' #sch')。append(rept);
}

});


},
错误: function (){
$(' #sch')。empty();
$(' #sch')。text(' 发生错误');
}
});

解决方案

.ajax({
url:' jen.php'
datatype:' json'
jsonp:' jsoncallback '
超时: 5000
成功:功能(数据,状态){


' #sch') .empty();
alert(' ');


.each(data, function (index,item){
var rept = ' < li>' + item.id + ' < /立GT;';

i get this error wen i try running this script ...pls help


TypeError: invalid 'in' operand obj" // when i view the console



$.ajax ({
			url:'jen.php',
			datatype:'json',
			jsonp:'jsoncallback',
			timeout:5000,
			success:function(data, status){
				$('#sch').empty();
				alert('');
				
				$.each(data,function(index,item){
                                var rept = '<li>'+item.id+'</li>';
					$('#sch').append(rept);	
                }

				});
				
				
			},
			error:function(){
				$('#sch').empty();
				$('#sch').text('error occured');
				}
			});

解决方案

.ajax ({ url:'jen.php', datatype:'json', jsonp:'jsoncallback', timeout:5000, success:function(data, status){


('#sch').empty(); alert('');


.each(data,function(index,item){ var rept = '<li>'+item.id+'</li>';


这篇关于jQuery失败,“operand obj”中的“TypeError:invalid”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆