0

hello can somone please tell me why i cannot submit this twice i have a php form doing the validation and mailing but if there are errors in the form filling out it will send back an errorand tell them to fix it, without refreshing the form.
the problem is the seccond time i click submit it does the initial form hide but stays stuck on sending the data to the php form again, could it be a cache issue and if so please show where exactly i should put the data or math multiplier because if i put it in the url by say adding url:'mailer.php' + date(), this then causes the program to fail, so any help would be apprieciated.

$(document).ready(function() {
	$("#Register").click(function(){
  	$("#Form").hide('fast');
	$("#LoadingMessage").animate({marginTop:"150"}).fadeIn('slow');
	var formData = $('#Form').serialize();
	submitForm(formData);
	return false;
	});
});
	function submitForm(formData){
        $.ajax({
        	
	   type:'POST',
            url: 'mailer.php',
            data: formData,
            dataType: 'json',
            cache: false,
            timeout:7000,
            success:function(data){
           if(data.success == true){
            $("#LoadingMessage").hide('fast');
		$("#Thankyou").fadeIn('slow');
	}else{
             $("#LoadingMessage").hide('fast');
			 $("#Error").fadeIn('slow').delay(2000);
			 $("#Error").fadeOut('slow');
			 $("#Form").delay(4000).show('fast');
				 
           }
          }
    });
};

any help please
thank you in advance.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by twiss
0

POST requests should not be cached. You might want to do some logging, what data does the server get, does it respond correctly?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.