Dancer
Dancer

Reputation: 17651

submit a form - results appear in fancybox?

Is it possible to submit a form so that the target (for returned data) is the Fancybox Jquery Lightbox?

Thanks Paul

Upvotes: 1

Views: 487

Answers (1)

Jason Kaczmarsky
Jason Kaczmarsky

Reputation: 1686

Use an AJAX post to the backend script and push the returned data to the lightbox.

$('#form_id').submit(function(e)){
    //stop the form from submitting
    e.preventDefault();

    //send the form data to the backend script
    $.post('backend_script.php',$(this).serialize(),function(msg){
        //alert(msg)
        //add content to lightbox here
    });
});

Upvotes: 1

Related Questions