ajax 500错误

ajax 提交500

$.ajax({
	type: 'post',
	url: '../caption/getArticles',
	data:{"sign":id,"name":name},
	dataType: "html",
	cache:false,
	contentType: 'application/json;charset=UTF-8',
	success: function(data){
		$('#loading').html(data);
	},
	error:function(data) {
		console.log(data.msg);
	},
});		

参数格式为{“sign”:id,“name”:name},contentType设置’application/x-www-form-urlencoded’,不能用json ‘application/json;’
设置contentType:charset=UTF-8 不然action接受的参数中文乱码

你可能感兴趣的:(ajax 500错误)