At one point my code compiles correctly – all the lines etc – but the same code at a different place (by place i mean function) does not compile completely.
Here is the code:
function updateEmployeeFunction() {
updateFields.username = $("#usernameTxtInfo").val();
updateFields.password = $("#passTxtInfo").val();
updateFields.confPasswrord = $("#confPassTxtInfo").val();
updateFields.firstName = $("#firstNameTxtInfo").val();
updateFields.lastName = $("#lastNameTxtInfo").val();
updateFields.email = $("#emailTxtInfo").val();
updateFields.phone = $("#phoneTxtInfo").val();
validateUsernameUpdate(updateFields.username);
validateEmailUpdate(updateFields.email);
validateFirstNameUpdate(updateFields.firstName);
ValidatePhoneUpdate(updateFields.phone);
validatePasswordUpdate(updateFields.password);
validateConfirmPasswordUpdate(updateFields.password, updateFields.confPasswrord);
if (updateFields.usernameCheckSuccess == true && updateFields.emailCheckSuccess == true &&
updateFields.firstNameCheckSuccess == true && updateFields.phoneCheckSuccess == true &&
updateFields.passwordCheckSuccess == true && updateFields.confPassCheckSuccess == true) {
callUpdateUser();
}
}
and heres the code for the update user
function callUpdateUser() {
$(".ajaxLoader").show();
var URL = getUpdateUserUrl();
$.ajax({
type: "POST",
url: URL,
cache: false,
processData: true,
success: updateUserCallSuccess,
error: ajaxError
});
}
The function updateEmployeeFunction is called when the update button is clicked,
and the validate functions, all of them, update the updateFields.checks respectively.
What my code is doing is that it is validating well and good but it does not go to the if part, where the real update is, but when i put debugger on it, it runs correctly.
Am I doing something wrong here and I have to click the update button twice to get it working?
And btw I am making a page in asp.net
This was exactly what was happening, thanx mate for your reply,
i delayed the if for 500 ms, and now, it works perfectly…