嗨:)当使用Firebug时,我可以看到它返回0或1,所以php是可以的。但似乎ajax server_reponse没有得到它..不知何故。有人看到问题吗?
j.ajax({
type: "POST",
url: "php/inc/ajax_check_username.php",
data: "username=" + username,
success: function (server_response) {
j("#availability_status").ajaxComplete(function (event, request) {
if (server_response == '0') {
alert('ledig..');
j("#availability_status").html('<p>Ok 0</p> <font color="Green"> Ledig! </font>');
} else if (server_response == '1') {
alert('IKKE ledig..');
j("#availability_status").html('<p>Ok 1</p> <font color="red">Ikke Ledig... </font>');
}
});
} // server resp
});
答案 0 :(得分:0)
你试过这个吗
j.ajax({
type: "POST",
url: "php/inc/ajax_check_username.php",
data: "username=" + username,
success: function (server_response) {
if (server_response == '0') {
alert('ledig..');
j("#availability_status").html('<p>Ok 0</p> <font color="Green"> Ledig! </font>');
} else if (server_response == '1') {
alert('IKKE ledig..');
j("#availability_status").html('<p>Ok 1</p> <font color="red">Ikke Ledig... </font>');
}
} // server resp
});
服务器有什么可能的响应?只是'0'或'1'?