Facebox and Form Submission

268 views
Skip to first unread message

Nason House

unread,
May 9, 2012, 3:05:04 PM5/9/12
to facebox
I think Facebox is great and would like to use it to display the thank
you page that appears after form submission on this test site
http://nasonhouse.com/test/steve/index.html

The form is not in a Facebox, but I do use facebox on this site for
something else, so I already have the files downloaded. The form is
validated with a php form processor that redirects to a thank you page
after form submission. Is there a way have this redirected page
controlled by the php document to open up in a facebox?

Thanks so much!

Dennis Notebaart

unread,
Apr 26, 2013, 6:51:32 AM4/26/13
to fac...@googlegroups.com
You should probably use jQuery to send the form data via Ajax to your PHP script and when it returns no error trigger facebox to show up.
Something like this (not tested):

$("#the_form").on('submit', function(e){
e.preventDefault();
var data = $(this).serialize();
$.ajax({
type: "GET",
url: "process_form.php?"+ data
}).done(function(msg) {
if (msg=='success') {       // have your php script return success or error or something like that after processing your data
$.facebox({ div: '#thanx' });      // make a div#thanx on your page and set the css display attribute to none (display:none;)
});
});

Op woensdag 9 mei 2012 21:05:04 UTC+2 schreef Nason House het volgende:
Reply all
Reply to author
Forward
0 new messages