在使用jquery的post方式的时候可能出现的问题:
$.post(
hrefVal,
function(data) {
if(data.status=="success") {
location.reload();
alert(data.msg);
} else {
alert(data.msg);
}
},
"json"
);
如果在使用的时候忘记了把json写上的话,就会报undefined错的,因为这个时候
浏览器不知道返回来的数据作何处理?是json还是html还是txt文件
$.post(
hrefVal,
function(data) {
if(data.status=="success") {
location.reload();
alert(data.msg);
} else {
alert(data.msg);
}
},
"json"
);
如果在使用的时候忘记了把json写上的话,就会报undefined错的,因为这个时候
浏览器不知道返回来的数据作何处理?是json还是html还是txt文件