Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery(document).ready(function($) {
- var AjaxRunning = 0;
- $('form').submit(function(event){
- event.preventDefault();
- if( !AjaxRunning ){
- $.ajax({
- type: 'POST',
- url: AJAX.url,
- data: {
- action: 'my_ajax_function',
- nonce: AJAX.nonce,
- },
- dataType: 'json',
- beforeSend: function(){
- AjaxRunning++;
- },
- success: function( result ) {
- if (result.success) {
- console.log( 'success' + AjaxRunning );
- }
- },
- complete: function(){
- AjaxRunning--;
- }
- });
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement