| 1 |
<?php |
| 2 |
/** |
| 3 |
* Sticky admin notices JavaScript handler for dismissing notice messages |
| 4 |
* by sending AJAX call to the server in order to remove the message from the Database. |
| 5 |
* |
| 6 |
* @package Freemius |
| 7 |
* @copyright Copyright (c) 2015, Freemius, Inc. |
| 8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 |
* @since 1.0.7 |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! defined( 'ABSPATH' ) ) { |
| 13 |
exit; |
| 14 |
} |
| 15 |
?> |
| 16 |
<script type="text/javascript" > |
| 17 |
jQuery(document).ready(function($) { |
| 18 |
$('.fs-notice.fs-sticky .fs-close').click(function(){ |
| 19 |
var |
| 20 |
notice = $(this).parents('.fs-notice'), |
| 21 |
id = notice.attr('data-id'), |
| 22 |
slug = notice.attr('data-slug'); |
| 23 |
|
| 24 |
notice.fadeOut('fast', function(){ |
| 25 |
var data = { |
| 26 |
action: 'fs_dismiss_notice_action_' + slug, |
| 27 |
slug: slug, |
| 28 |
message_id: id |
| 29 |
}; |
| 30 |
|
| 31 |
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php |
| 32 |
$.post(ajaxurl, data, function(response) { |
| 33 |
|
| 34 |
}); |
| 35 |
|
| 36 |
notice.remove(); |
| 37 |
}); |
| 38 |
}); |
| 39 |
}); |
| 40 |
</script> |