-
Wearing parameters through Ajax
-
$ (function () {
-
-
$ (". tab #det"). Click (function () {
-
-
var url= "./doadminaction.php";
-
$.ajax ({
-
Type: "GET",
-
Url:url,
-
Async:true,
-
data:{' CID ': $ (this). attr ("name")},
-
//data: {' pName ':p name, ' CID ': CID, ' pSn ':p sn, ' pName ':p name, ' Mprice ': Mprice, ' iprice ': Iprice, ' Pdesc ':p desc , ' Pubtime ':p ubtime, ' pubtime ':p ubtime, ' isshow ': isshow, ' ishot ': Ishot},
-
DataType: ' JSON ',
-
Success:function (response) {//Return data according to the results of the corresponding processing
-
//var Jsontext=result.parsejson ();
-
alert (RESPONSE.PDESC);
-
},
-
Error:function (Result) {
-
console.log (' Error ');
-
}
-
});
-
-
});
-
});
-
3.php back end to obtain the parameters of the database query, the results of the query output, in the Json_encode ($value, Json_unescaped_unicode) to convert to JSON transmission, where the pit before encountered is Utf-8 transcoding problem, Later found that the use of json_unescaped_unicode can be a good solution
This article is from the "12380959" blog, please be sure to keep this source http://12390959.blog.51cto.com/12380959/1964252
About the PHP backend and JS front-end interaction problems