# powerkit/2.3.2/extensions/connect/js/admin-powerkit-connect.js

Powerkit – Supercharge your WordPress Site, version 2.3.2. 47 lines.

- Page: https://pluginprobe.com/plugins/powerkit/2.3.2/code/extensions/connect/js/admin-powerkit-connect.js
- Raw: https://pluginprobe.com/plugins/powerkit/2.3.2/raw/extensions/connect/js/admin-powerkit-connect.js
- Modified: 2020-08-15T09:25:02+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/powerkit/2.3.2/code/extensions/connect/js/admin-powerkit-connect.js#L10-L20`.

```javascript
( function( $ ) {
	'use strict';

	$( function() {

		/*
		* AJAX Reset cache
		*/
		$( document ).on( 'click dblclick', 'a[href*="action=powerkit_reset_cache"]', function( e ) {
			var $this = this;
			$.ajax( {
				type: 'POST',
				url: window.pk_connect.ajax_url + '?action=powerkit_reset_cache',
				data: {
					page: $( $this ).attr( 'href' ).split( 'page=' ).pop().split( '&' ).shift(),
				},
				beforeSend: function() {
					$( $this ).siblings( '.spinner, .status' ).remove();

					$( $this ).after( '<span class="spinner is-active"></span>' );
				},
				success: function( data ) {
					$( $this ).after( '<span class="status dashicons dashicons-yes"></span>' );
				},
				error: function() {
					$( $this ).after( '<span class="status dashicons dashicons-no-alt"></span>' );
				},
				complete: function() {
					$( $this ).siblings( '.spinner' ).remove();

					setTimeout( function() {
						$( $this ).siblings( '.status' ).fadeOut();
					}, 2000 );
				}
			} );

			// Refresh customizer.
			if ( $( 'body' ).hasClass( 'wp-customizer' ) ) {
				wp.customize.previewer.refresh();
			}

			return false;
		} );

	} );

} )( jQuery );
```
