954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Ajax, jquery problems

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.

Braden0007
Newbie Poster
1 post since May 2011
Reputation Points: 10
Solved Threads: 0
 

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

twiss
Veteran Poster
1,005 posts since Apr 2010
Reputation Points: 177
Solved Threads: 101
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: