我更新jquery到一箇舊版本的文件,有一些新的功能添加更新的版本。現在,jquery ajax發佈已停止工作。我試圖改變成功,但這並沒有解決問題。Ajax請求與jQuery的舊版本不是新的
// check email in database
$("#email_address").change(function() //this function needs tidying up!
{ //if theres a change in the email textbox
var email_address = $("#email_address").val(); //Get the value in the username textbox
if (email_address.length > 3) //if the lenght greater than 3 characters
{
$("#availability_status").html('<img src="../img/loader.gif" align="absmiddle"> Checking this email is not already registered<br />'); //Add a loading image in the span id="availability_status"
$.ajax({ //Make the Ajax Request
type: "POST",
url: "../ajax_check_email.php", //file name
data: "email_address=" + email_address, //data
success: function (server_response) {
$("#availability_status").ajaxComplete(function (event, request) {
if (server_response == '0') //if ajax_check_email.php return value "0"
{
$("#availability_status").css("display", "none");
} else if (server_response == '1') //if it returns "1"
{
$("#availability_status").css("display", "inline");
$("#availability_status").html('<font color="red">This email address is already registered in our database. </font>');
}
});
}
});
}
return false;
});
我完全刪除了.ajaxComplete(),它工作。謝謝。 – JakeKempo