I'm attempting to post a form from FoncyBox2 and have so far had no luck. The result of the following code is a closed overlay. Nothing else happens. No error. No nothing. All I want is for the result (which is in this case the content of the field) to appear in place of the form in the same overlay.
HTML:
<a class="fancybox fancybox.ajax" href="formPage.php">Open Overlay</a>
JavaScript:
$(document).ready(function(){
$(".fancybox").fancybox();
$("#question-form").bind("submit", function() {
$.fancybox.showActivity();
$.ajax({
type : "POST",
cache : false,
url: "formProcessing.php",
data: $(this).serializeArray(),
success:function(data){
$.fancybox(data);
}
});
return false;
});
});
Form (formPage.php):
<form id="question-form" action="" method="POST">
Name <input type="text" name="name">
<input type="submit" value="Send">
</form>
Form processing (formProcessing.php):
print_r($_POST);
Oh, I'm not worried about validation. I'm planning to do that another way.
Thanks, @rrfive