ajax请求(二),后台返回的JSon字符串的转换

时间:2025-04-07 09:02:49

ajax请求,json的转换

         $.ajax({
url : "../folder/isExistAddFolder.do?t="+new Date(),
type : 'POST',
data:{"foldername":foldername,
"parentid":parentid,
"foldertype":foldertype
},
success : function(result){
if(result==true){
$('#addfolderfrom').form('submit', {
url : urls,
onSubmit : function() {
return $(this).form('validate');
},
success : function(data) {
// alert(JSON.stringify(data));
var result = eval('(' + data + ')');
if (result.error) {
top.showAlert('提示',result.msg , 'info');
} else {
reloadDatas('queryFolder.htm', 'projectfenlei',parentid,4);
reloadData('PorjectInfo', 'projectInfo');
closeUnit();
// }
}
}
});
}else{
top.showAlert('提示', '项目名称已存在', 'info');
}
},
dataType:"json",
error : function(result) {
}
});