从ajax调用返回的错误是从未成功的页面加载返回结果.可能是您的php页面返回了一个有效页面,但结果不是您想要的.这是在成功回归的情况下处理的.希望以下代码snippit有助于说明……
$.ajax({
type: "POST",
url: "login.php",
data: "action=login&user=" + user + "&pass=" + pass,
success: function(xhr){
if ((xhr == "Invalid Login")
|| (xhr == "Invalid charaters in username.")
|| (xhr == "Missing username or password.")
|| (xhr == "Unknown Error")) {
$("#loginMessageContent").html(xhr);
}
else {
simplemodalClose (dialog);
}
},
error: function(xhr) {
alert ("Oopsie: " + xhr.statusText);
}
});