Form Validation with Jquery not working
Hello,
Ive made a form validation with jquery with the following code
- $('#save').click(function(){
$.ajax({
url: "../scripts/availability.php",
type: "POST",
cache: false,
data:{
stamp: $("#stamp").val(),
jprefix: $("#jprefix").val(),
tprefix: $("#tprefix").val(),
starting_date: $("#starting_date").val(),
ending_date: $("#ending_date").val(),
starting: $("#starting").val(),
ending: $("#ending").val(),
colab_id: $("#colab_id").val(),
id: $("#id").val(),
session_id: $("#session_id").val()
},
dataType: "html",
success: function(msg){
if($(msg).html()==1){
if($("#starting").val() < $("#ending").val() && valDate()){
$("#serviceForm").submit();
}else{
alert ("Conflicto na data ou hora do serviço");
}
}else{
alert("Sobreposição de Colaborador");
}
}
});
});
- function valDate(){
if($("#starting_date").length){
if($("#starting_date").val() <= $("#ending_date").val()){
return true;
}else{
return false;
}
}else{
return true;
}
}
But the problem is that it some times works some times doesn't i couln't find any padron, and for as strange as it seems is works more times on IE than FF
I would apreciate your help :)
Thank you in advanced,
Eduardo Oliveira