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

ajax请求,json的转换

 1         $.ajax({
 2             url : "../folder/isExistAddFolder.do?t="+new Date(),
 3             type : 'POST',
 4             data:{"foldername":foldername,
 5             "parentid":parentid,
 6             "foldertype":foldertype
 7             },
 8             success : function(result){
 9                 if(result==true){
10                         $('#addfolderfrom').form('submit', {
11                             url : urls,
12                             onSubmit : function() {
13                                 return $(this).form('validate');
14                             },
15                             success : function(data) {
16 //                                alert(JSON.stringify(data));
17                                 var result = eval('(' + data + ')');
18                                 if (result.error) {
19                                     top.showAlert('提示',result.msg , 'info');    
20                                 } else {
21                                         reloadDatas('queryFolder.htm', 'projectfenlei',parentid,4);
22                                         reloadData('PorjectInfo', 'projectInfo');
23                                         closeUnit();
24 //                                    }
25                                 }
26                         }
27                     });
28                 }else{
29                    top.showAlert('提示', '项目名称已存在', 'info');    
30                 }
31             },
32             dataType:"json",
33             error : function(result) {
34             }
35         });
原文地址:https://www.cnblogs.com/tian830937/p/4435492.html