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事件调用。但问题是响应(函数)总是返回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);
%>
请帮帮我。我被困在这里........ 它总是返回虚假。并且页面卡住了
答案 0 :(得分:0)
我认为你错过了});最后。