I\'m using Fancybox to have a contact form pop up when a link is clicked. Then it POSTs the form data to a php file, an email goes out and a success message comes back.
It was a simple mistake, I was putting the script above in its own <script>
tags instead of in the main fancybox attach script
. My final code is:
<script type="text/javascript">
$(document).ready(function(){
$("a.lightbox").fancybox({
'transitionIn' : 'fade',
'transitionOut' : 'fade',
'speedIn' : 600,
'speedOut' : 200,
'overlayShow' : false
});
$("#question-form").bind("submit", function() {
$.fancybox.showActivity();
$.ajax({
type : "POST",
cache : false,
url : "/includes/question-mailer.php",
data : $(this).serializeArray(),
success :function(data){
$.fancybox(data);
}
});
return false;
});
});
</script>