jquery ajax和php实现返回值 json类型

it2025-05-25  34

js页面 $.ajax({ type: “POST”, dataType: ‘json’, url: “add_vote.php”, data: “touid=”+uid+”&tousername=”+username, success: function(msg){ //json解析方法一 var dataObj=eval("("+msg+")");//转换为json对象 alert(dataObj.goods_list);//输出root的子对象数量 //json解析方法二 var result = JSON.parse(msg); alert(result[key]); 方法二在IE6.7下需要加载js文件才行。json2下载 } }); php页面 $arrall = array(1=>”王辉”,2=>”wanghui”); echo json_encode($res);

 

转载于:https://www.cnblogs.com/whlives/p/3881041.html

相关资源:DirectX修复工具V4.0增强版
最新回复(0)