for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
/** global: GLSR, jQuery */
;(function( x ) {
'use strict';
GLSR.Ajax = {
/** @return void */
post: function( request, callback ) { // object, function|void
var data = {
action: GLSR.action,
request: request,
};
x.post( GLSR.ajaxurl, data, function( response ) {
if( typeof callback !== 'function' )return;
callback( response );
});
},
postFromEvent: function( ev, request, callback ) { // Event, object, function|void
ev.preventDefault();
var el = x( ev.target );
if( el.is( ':disabled' ))return;
request.nonce = request.nonce || el.closest( 'form' ).find( '#_wpnonce' ).val();
el.prop( 'disabled', true );
if( typeof callback === 'function' ) {
}
el.prop( 'disabled', false );
})( jQuery );