-
var url=
'/merchant/updateMerchant';
-
$.ajax({
-
type :
'post',
-
url : url,
-
dataType :
'json',
-
data : $(
"#merform").serialize(),
-
success :
function(jsonStr) {
-
// var obj=JSON.parse(jsonStr)
-
// if(obj.rspCode=='00'){
-
if(jsonStr.rspCode==
'00'){
-
alert(
'商户更新成功');
-
if(status ==
"able"){
-
window.location.href=
'/merchant/merchantList?page=1&count=10';
-
}
else{
-
window.location.href =
'/merchant/disableMerchantList?page=1&count=10';
-
}
-
}
else{
-
alert(
'商户更新失败');
-
}
-
}
-
});
dataType值如果为'json',jquery就会把后端返回的字符串尝试通过JSON.parse()尝试解析为js对象。
dataType值如果为'text',结果弹出框直接显示后台返回的json字符串。
dataType值如果为'html',结果弹出框直接显示后台返回的json字符串。
注意:在java中,一般都是json串;而JSON对象,则常存在于js代码块中
参考:
https://blog.csdn.net/u013476542/article/details/61414401/