jquery - Return "success" message after form submit -
i trying return "thank you" message after successful jquery email validation , form submission. want show "thank you" message , prevent page redirecting action url still process data server side. while researching think jquery callback sounds right need more direction examples found bit on place. can provide input?
$("#emailsignup_form").validate(); }); $('#submitemail').click(function() { app.ajax.load({ reqname : 'emailsubmit', url: "$httpurl('bronto-optin')$?email=" + $('#email').val(), selector : '#emailbox', callback: function(responsetext, textstatus) { } return false; } }); <form id="emailsignup_form" method="post" action="$httpurl('bronto-optin', 'fid', 'information')$"> <input id="cemail" name="email" size="25" class="required email" /> <input class="submit" id="submitemail" type="submit" value="submit"/> </form> <div id="emailbox"></div>
assuming add div
show result of post
<form id="emailsignup_form" method="post" action=""> <input id="cemail" name="email" size="25" class="required email" /> <input class="submit" id="submitemail" type="submit" value="submit"/> </form> <div id="postresult"> </div>
you can post data $.post()
this
$(function(){ $("form#emailsignup_form").submit(function(e){ e.preventdefault(); $.post( "processdata.php", $(this).serialize(), function(data){ //your code process returned data goes here $("#postresult").text("thank you!"); } ); }); });
Comments
Post a Comment