这就是我的代码中的内容。它只被调用一次。我需要刷新页面再次调用此函数。
$('#btnajaxcontrol').click(function () {
var mail = document.getElementById("txtmail").value;
var fname = document.getElementById("txtfname").value;
var lname = document.getElementById("txtlname").value;
var addr = document.getElementById("txtaddress").value;
var mobile = document.getElementById("txtmobile").value;
if (ValidateEmail(mail) && !(mail == "") && !(fname == "") && !(lname == "") && !(addr == "") && !(mobile == "")) {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "CRUDwebserviceJS.asmx/registerWS",
data: { 'email': mail, 'firstname': fname, 'lastname': lname, 'address': addr, 'mobile': mobile },
cache: false,
success: function (data) {
var wsres = data.d;
if (wsres == 'true') {
$('#lblmsg').html('User Successfully Registered...');
}
},
error: function (result) {
alert(result);
$('#lblmsg').html('User Registeration faild...!');
$("#lblmsg").css('background', 'red');
}
});
}
});