Submit form after (ajax) validation
Hello,
I've a form. Before submit this forum i have to check if there are uploaded pictures for this form. I check the pictures with ajax. If there are no pictures the must come a alert (see below) otherwise the form must bu submitted with a post (regular submit, no ajax or something). It's working fine but only the formsubmit don't work. Someone who know this 'problem'?
-
<script type="text/javascript">
$(document).ready(function(){
$("#submit").click(function(){
$.post(
"/ajax-check-pics.php?id='.$id.'",
$("#ajax-form").serialize(),
function(data){
if (data.message == 0) {
alert("No pictures");
}
{
$("form").submit();
}
},
"json"
);
return false;
});
});
</script>