views:

65

answers:

2

Hi all. Long time reader, first time writer. Quick query i hope someone can help me with.

I have a webpage (php, javascript) which has a small contact form for a user to fill in and email us. Not a problem in itself, i have a working form already.

Nothing noteworthy, just a form posting to a php page which sends an email.

<form id="myform" name="myform" method="post" action="Mailer.php">

So user fills in form, hits submit and the page changes to mailer.php and they find their way back to where they were.

What I want instead is for the to stay on the same page when submit is pushed. The form div to update itself to just say 'message sent' or something. I just want to avoid a full page refresh.

Much like how on say facebook, commenting on a status only updates that div.

Hope that is phrased clearly enough.

Cheers all,

+3  A: 

Take a look at the jQuery Form plugin: http://jquery.malsup.com/form/

BradBrening
A: 

I think its clear what your asking - but not what answer you are expecting. Yes, an obvious solution is to use ajax to send the request serverside - and when the ajax request completes it replaces the innerHtml on the div.

What have you tried in order to achieve this, and why is it not working as you expect?

Maybe this link will help.

symcbean