-
通过ajax穿参数
-
$(function(){
-
-
$(".tab #det").click(function (){
-
-
var url="./doAdminAction.php";
-
$.ajax({
-
type : "GET",
-
url : url,
-
async:true,
-
data:{'cid':$(this).attr("name")},
-
//data : {'pName':pName,'cid':cid,'pSn':pSn,'pName':pName,'mPrice':mPrice,'iPrice':iPrice,'pDesc':pDesc,'pubTime':pubTime,'pubTime':pubTime,'isShow':isShow,'isHot':isHot},
-
dataType: 'json',
-
success : function(response) {//返回数据根据结果进行相应的处理
-
//var jsonText=result.parseJSON();
-
alert(response.pDesc);
-
},
-
error : function(result){
-
console.log('error');
-
}
-
});
-
-
});
-
});
-
3.php后端获取参数后进行数据库查询,将查询结果进行输出,在通过json_encode($value,JSON_UNESCAPED_UNICODE)进行转换为json传输,其中之前遇到的坑是utf-8转码问题,后来发现使用JSON_UNESCAPED_UNICODE可以很好的解决