rendered paste body $('#facebox form#send_mail').live('submit', function(event){
var $form = $(this);
$.ajax({
url: $form.attr('action'),
type: 'POST',
data: $form.serialize(),
dataType: 'json',
complete: function(response) {
if (response.statusText == 'parsererror') { // no valid JSON returned, this is HTML to inject
$form.html(response.responseText);
}
},
success: function(response) {
$.facebox.close();
$('#notification').html($('<ul class="' + response.type + '"><li>' + response.message + '</li></ul>'));
}
});
event.preventDefault();
});