嘿,我所有的代码如下:
JS:
$.ajax({
type: "POST",
url: "master.php",
contentType: "application/json; charset=utf-8",
data: { "called": "REG",
"fname": $("#FName").val()
},
dataType: "json",
success: function(data, responseText, textStatus){
response = jQuery.parseJSON(data);
console.log("good: " + response);
console.log("good3: " + textStatus);
console.log("good3: " + responseText);
},
error: function(XMLHttpRequest, textStatus, errorThrown){
console.log("error: " + textStatus);
}
});
我的 master.php 有:
<?php
$called = $_POST['called'];
if ($called == 'REG') {
$json = array('good' => 'the value here');
header("Content-Type: application/json", true);
echo json_encode($json);
}
?>
我得到的控制台输出是这样的:
好:空 form.php:102
good3: [对象对象] form.php:103
好3:成功
我会错过什么?