0

My simple one field form is at the bottom of this page:

http://kaye.at/books/

How do I get it so that the 'Success' or 'Error' message either replaces the field itself on submit or shows below, rather than sending the user to a whole other page?

HTML:

<div class="email-wrap">

<form id="emailForm" style="display: block;" action="form.php" method="POST">
                <div>
                    <input type="text" value="Recommend a book" name="mail" id="mail">
                    <input type="submit" name="button" value="GO">
                </div>
</form>

</div>
PeeHaa
  • 71,436
  • 58
  • 190
  • 262
user1393984
  • 1,319
  • 3
  • 13
  • 17

1 Answers1

0

How about using ajax post to pass the text box value and on success or error update the field or show the returned message below the text box.

Please refer a sample to post using ajax. Proper way to use AJAX Post in jquery to pass model from strongly typed MVC3 view

or refer below link for using jquery.post() http://api.jquery.com/jQuery.post/

Community
  • 1
  • 1
Girish Sakhare
  • 743
  • 7
  • 14