I have a contact form open in thickbox i want when user click on submit form data submit to my php that will process that data and show sucessfull msg back to thickbox. php page is called but how i will get form data?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First use thickbox’s iframe feature to load the form in the thickbox. Make sure you have jquery and thickbox loaded by putting this in the HTML head of your document:
Then put a link on the page the loads the contact us form in the iframe:
Your form should have markup that has this basic structure:
Now use jQuery to your form via AJAX. Put this in the head of the HTML document:
What this does is:
Adds a function to the form to be called when the form is submitted. It returns false to prevent the default behavior of a form submitting from happen.
This submit function will do an AJAX post, using the action of the form, which you set to
contact_us.php.Finally, this will take whatever content
contact_us.phpreturns and replace the content of the div with the id content with that.So make your
contact_us.phpscript actually send the email or create a database record, whatever it does, and then have it return this HTML:Obviously this can be anything you want, whatever message you want the end user to see. The link shows you how to make the thickbox window go away.