I have two validation jQuery functions which I need to fire one after another. If the first validation is passed then only the second fucnction should call. In my case both of them are firing simulteniously. Here is the code
$("#btnValidate").live('click', function (event) {
$.ajax({
data: {
procCode: '001'
},
url: "jsp/Process.jsp",
success: function (result) {
$("#tdValidYN").html(result);
if (document.getElementById('hidValidYN').value == 'N') {
alert("Validation Failed. Required Columns Missing");
$('#btnSave').attr('disabled', true);
} else {
alert("Validation Passed");
$('#btnSave').attr('disabled', false);
}
}
});
$.ajax({
data: {
procCode: '002'
},
url: "jsp/Process.jsp",
success: function (result) {
$("#tdValidYN").html(result);
if (document.getElementById('hidValidYN').value == 'N') {
alert("Validation Failed. Invalid Parameters Used");
$('#btnCreateTable').attr('disabled', true);
} else {
alert("Validation Passed");
$('#btnCreateTable').attr('disabled', false);
}
}
});
});
I tried to put the second function under the if condition of the the first function but script error is happening.
Please help.
something like this may work:
if thats what you tried, whats the error your getting ?