/ Published in: jQuery
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$.ajax({ url: '', type: 'POST', dataType: 'json', data: {}, beforeSend: function(){ $('#load-msg').show(); }, success: function(data) { $('#load-msg').hide(); if(data.errorStatus){ alert(data.errorMsg || 'An error has occurred'); }else{ // do stuff } }, error: function() { $('#load-msg').hide(); alert('An error has occurred'); } });