0

On submit, it doesn't close the facebox for some reason. Can you guys help me out?

my code is:

<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script type="text/javascript">

$(function() {

 $('#reset_form').click(function() {
     $('#name,#comment').val('');
 });
 $('#submit').click(function() {

var name = $('#name').val();
var comment = $('#comment').val();

$.ajax({
    url: '../forms/comment_ajax.php?id=<?php echo $_GET['id']; ?>',
    data: { form_name: name, form_comment: comment },
    success: function(data) {
        $('#new_comment').append(data);

        $(document).trigger('close.facebox');

        $('#new_comment').effect("bounce", { direction:'down', times:5 }, 300);        
        $('html,body').animate({scrollTop:0}, 2000, "easeOutQuart");
        return false;
    }
});
});                    
});
</script>



Name: <br />
<input type="text" id="name" class="userpass" maxlength="15"/><br /><br />

Comment: <br />
<textarea id="comment" rows="6" cols="75"></textarea><br /><br />

<input type="submit" id="submit" value="Comment" class="button" />
<input type="reset" id="reset_form" name="submit" value="Reset" class="button" />

this isn't doing it $(document).trigger('close.facebox');

I have it opened in a facebox. The index for it to post on is: http://pastebin.com/JhpDhevr

Kinda messy, but yeah. It's not closing on submit.

TrippedStackers
  • 427
  • 1
  • 4
  • 17

1 Answers1

0

try

 $('#button-id').click($.facebox.close);

instead of

$(document).trigger('close.facebox');
sasi
  • 4,192
  • 4
  • 28
  • 47