function duplicateCountry() {
var username = $('#Country_name').val();
if (username == "" || username.length < 4) {
$('#Country_name').css('border', '3px #CCC solid');
return false;
}
alert(username);
jQuery.ajax({
type: "POST",
url: "${pageContext.request.contextPath}/jsp/admin/master/Checkcountry.jsp",
data: 'username= ' + username,
cache: false,
success: function (response) {
if (response == 2) {
alert("Success");
}
},
error: function () {
document.getElementById("Error").innerHTML = "*duplicate value"
alert("fail");
return false;
}
});
}
duplicateCountry 函数由按钮的 onclick 事件调用。但问题是 response(function) 总是返回 false 虽然它完美地执行 Checkcountry.jsp
这个是我的 Checkcountry.jsp
<%
DBCountry op = new DBCountry();
String edit=request.getParameter("edit").trim();
String hide = request.getParameter("hide").trim();
int i = op.updateCountry(edit,hide);
response.setStatus(i);
%>
请帮帮我。我被困在这里............它总是返回假。页面卡住了