this.options.url = this.options.url || document.location.href;
this._originalUrl = this.options.url;
},
- _onFailure: function(data) {
+ _onFailure: function(data, status) {
+ var msg, title = ts('Network Error');
this.options.block && this.element.unblock();
this.element.trigger('crmAjaxFail', data);
- CRM.alert(ts('Unable to reach the server. Please refresh this page in your browser and try again.'), ts('Network Error'), 'error');
+ switch (status) {
+ case 'Forbidden':
+ title = ts('Access Denied');
+ msg = ts('Ensure you are still logged in and have permission to access this feature.');
+ break;
+ default:
+ msg = ts('Unable to reach the server. Please refresh this page in your browser and try again.');
+ }
+ CRM.alert(msg, title, 'error');
},
_onError: function(data) {
this.element.attr('data-unsaved-changes', 'false').trigger('crmAjaxError', data);
that._handleOrderLinks();
that.element.trigger('crmLoad', data);
that.options.crmForm && that.element.trigger('crmFormLoad', data);
- }).fail(function() {
- that._onFailure();
+ }).fail(function(data, msg, status) {
+ that._onFailure(data, status);
});
},
// Perform any cleanup needed before removing/replacing content