I have a simple Contact Us form placed in Div.. What i want is when user submits the form, After proper validation, instead of redirecting to other thank you page, I just want to remove the contact form from that Div and show him the "Thank You" Message
How do i do that ? Demo/Download Code will be helpful
A bit of searching would be great ;)
<div id="form>
[ Your HTML Form]
</div>
<script>
$([form]).submit(function () {
$("#id").html("Thank You");
});
</script>
A simple, great and widely used jQuery Form plugin:
http://jquery.malsup.com/form/
You can use this plugin to submit the form using ajax and then on success callback, show the appropriate response.
$("#submitBtn").click(function () {
$("#divId").html("Loading PleaseWait"); //divId contain all the text field
$.ajax({
type: "POST",
data: "data=" + $("#data").val(), //id of the text field (value)
url: "demo.php", //page name to which u r passing the value
success: function(msg){
if($("#divId").html(msg))
{
$("#divId").html("Thank You");
}
});
});