ajax返回[object Object]的处理办法
2018-08-18 12:24:52
Reading:1170
ajax加载失败返回[object Object],此时可以用error或complete接收返回结果data,用data.responseText将返回结果作为String,显示出来,或做其它处理。
<script>function addrow(id){
try {
$.ajax({
url : "getrow.php",
type : "post",
data : "id=" + id,
dataType : "html",
error : function(msg) {
alert('加载失败:'+msg.responseText);
},
success : function(msg) {
//
}
});
} catch (err) {
alert(err.description);
}
return true;
}
</script>