I have a question about how to use jquery to update a page, if a form action is successful.
Essentially, I am making a new page with a really simple form (name, email address, and comments boxes). I have made a real basic PHP file to call with the 'action=' attribute on the form. The php file does the job and sends me an email (if everything passed to it checks out).
Here is where things get... interesting. I want to have it:
1.
Not reload the page when the form is submitted. Instead, just update the current page - probably with a simple
slideDown() div.
2. Only do the jquery update (slidedown) if the PHP script is successful. i.e. after it validates everything, and actually sends an email off.
3. Not have the page itself be a php file. I'd like to have the php file be a seperate, php-only script (without html) that only takes care of validating/emailing the form, and returning anything to indicate if it worked.
I haven't done anything like this before.
The 2nd criteria above is the one I'm struggling the most with. Absolutely no idea how to get jquery to recognize the success/failure of an external (though simple) php script.
From the user's perspective, they fill out the form, hit submit, and the page slides down a "Thank you! Your feedback is appreciated" message. Deceptively simple. (assuming everything in the form validates, but I'm saving that for later).