cache = $(this); $.ajax({ url: '/assets/php/online-payment', type: 'post', data: 'invoice-number='+invoice+'&ajax=1', beforeSend: function(){ $('input[name="member-invoice"]').closest('.form-group').removeClass('has-error').addClass('has-success'); cache.append(' <i class="fa fa-spinner fa-pulse fa-fw"></i>'); $('#invoice-number input[name="member-invoice"]').parent().after('<span id="invoice-processing"><?php echo __("we are pulling your invoice information"); ?>...</span>'); $('#invoice-processing').hide().fadeIn(800); //disable the btn cache.prop('disabled', true); }, complete: function(){ alert('complete'); }, success: function(data){ alert(data); }, error: function(){ alert('<?php echo __("sorry, there was a problem processing your request"); ?>'); } });//AJAX | gstlouis |