Front end use code to submit and process subsequent results
Function del (ID) { if (Confirm (' Confirm to delete this keyword? ') {$.post ('./keyword ', {op: ' del ', Id:id},function (Result) {alert (result);//Normal This part should show Object:object, But now the display is a string if (Result.code! = 0) {alert ("Delete failed! ");} Else{location.reload ();}});}}
The service side uses the following code to return
echo Json_encode (Array ("code" =>0)); exit;
Normally in front of the alert result this variable should be shown as object:object, but this JSON string is now displayed.
Reply to discussion (solution)
$.post ('./keyword ', {op: ' del ', Id:id},function (Result) {...}, ' json ');
Function del (ID) { if (Confirm (' Confirm to delete this keyword? ') {$.post ('./keyword ', {op: ' del ', Id:id},function (Result) {alert (result);//Normal This part should show Object:object, But now the display is a string if (Result.code! = 0) {alert ("Delete failed! ");} Else{location.reload ();}}, "JSON");}}