(function ($) {
	"use strict";

	function dismissNotice(callback) {

		$.post(
			nova_autocare_localize.ajax_url,
			{
				action: 'nova_autocare_dismiss_admin_notice',
				nonce: nova_autocare_localize.nonce
			},
			function () {
				if (typeof callback === 'function') {
					callback();
				}
			}
		);
	}

	$('.nova-autocare-get-started').on('click', function (e) {
		e.preventDefault();

		var redirect = $(this).attr('href');

		dismissNotice(function () {
			window.location.href = redirect;
		});
	});

	$(document).on('click', '.notice-get-started-class .notice-dismiss', function () {
		dismissNotice();
	});

})(jQuery);