其他分享
首页 > 其他分享> > 使用$.ajax时报错:Uncaught ReferenceError: $ is not defined

使用$.ajax时报错:Uncaught ReferenceError: $ is not defined

作者:互联网

是因为我们没用定义$

var $ = layui.$;

var data = obj.data;
var $ = layui.$;
//console.log(obj)
if (obj.event === 'del') {
	layer.confirm('真的删除数据吗', function (index) {
	obj.del();
	console.log(data.id);
	layer.close(index);
	$.ajax({
		url: 'url',
		type:'post',
		data:{},
		success:function(data){
		},
		complete:function(){
		}
	})
	});
}

标签:function,index,layer,obj,defined,ajax,var,Uncaught,data
来源: https://blog.csdn.net/qq_27523379/article/details/120443706