# learnpress/4.1.7.3.2/assets/src/js/admin/share/admin-notice.js

LearnPress – WordPress LMS Plugin for Create and Sell Online Courses, version 4.1.7.3.2. 33 lines.

- Page: https://pluginprobe.com/plugins/learnpress/4.1.7.3.2/code/assets/src/js/admin/share/admin-notice.js
- Raw: https://pluginprobe.com/plugins/learnpress/4.1.7.3.2/raw/assets/src/js/admin/share/admin-notice.js
- Modified: 2022-11-14T02:57:44+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/learnpress/4.1.7.3.2/code/assets/src/js/admin/share/admin-notice.js#L10-L20`.

```javascript
( function( $ ) {
	const dismissNotice = function dismissNotice( notice, options ) {
		const hooks = wp.hooks;

		options = $.extend( { el: null }, options || {} );

		hooks && hooks.doAction( 'before-dismiss-notice', 'LP', notice, options );
		$.ajax( {
			url: '',
			data: $.extend( { 'lp-dismiss-notice': notice }, options.data || {} ),
			dataType: 'text',
			success: ( response ) => {
				response = LP.parseJSON( response );

				if ( response.dismissed === notice ) {
					$( options.el ).fadeOut();
				}

				hooks && hooks.doAction( 'dismissed-notice', 'LP', notice, options );
			},
		} );
	};

	$( document ).on( 'click', '.lp-notice [data-dismiss-notice]', function() {
		const data = $( this ).data();
		const notice = data.dismissNotice;

		delete data.dismissNotice;

		dismissNotice( notice, { data, el: $( this ).closest( '.lp-notice' ) } );
	} );
}( jQuery ) );

```
