Hi,
I'm using Jquery validate plugin.I need to validate two fields. I have some problems with the following code.I'm checking whether the given element valid and if it is valid I make an ajax call to check for few values and hide or show elements based on that. The problem is when the blur event happens, the validation is done. But the ajax request is not happening. How can i solve this problem. Thanks in advance.
$("#code").bind('blur',function(event) {
var isValid = $("#code").valid();
if(isValid)
{
$.ajax({
type: "GET",
url: "/ajaxValidateWithCode",
dataType: "json",
data: ({code : $("#code").attr('value')}),
success: function(msg){
//alert( "Data Saved: " + msg );
if(msg)
{
$("p#code").show();
}
else
{
$("p#code").hide();
}
}
});
}
else
{
$("p#code").hide();
}
});