当前位置:Gxlcms > JavaScript > 打印json对象的内容及JSON.stringify函数应用_json

打印json对象的内容及JSON.stringify函数应用_json

时间:2021-07-01 10:21:17 帮助过:6人阅读

在调试的时候,经常需要知道json对象的内容,通过JSON.stringify函数,可以转换json对象为字符串。
代码如下:

$(document).ready(function() {
$.ajax({
type: "post",
dataType: "json",
url: '/centermanage/modules/admin/index.php?task=getequipmentinfo',
data: "&id=" + id,
error: function(msg){
 alert(JSON.stringify(msg)); 
},
success: function(msg) {
alert(JSON.stringify(msg));
})
})


 



人气教程排行