1 回答
TA贡献1850条经验 获得超11个赞
sendContact应该只执行 AJAX 调用,它不应该调用$("#Register").click(). 这会在您下次单击按钮时添加一个事件处理程序,它不会发送 AJAX 请求。
function sendContact() {
var valid;
valid = validateContact();
if (valid) {
var username = $('#username').val();
var email = $('#email').val();
var password = $('#password').val();
var password1 = $('#password1').val();
var data = {
"username": username,
"email": email,
"password": password,
"password1": password1
};
jQuery.ajax({
data: data,
url: "phpquery/insert_patient.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
success: function(data) {
$('#username').val('');
$('#email').val('');
$('#password').val('');
$('#password1').val('');
}
});
});
}
- 1 回答
- 0 关注
- 152 浏览
添加回答
举报