nosAjax¶
- $container.nosAjax(options)¶
Performs an asynchronous HTTP (AJAX) request. This is a wrapper of jQuery.ajax().
Arguments: - options (JSON) –
JSON that configure the AJAX request. Same that jQuery.ajax() with some differences:
- Some defaults options.
- Callback functions success and error are monkey-patched
to execute defaults operations.
- Function $container.nosAjaxSuccess() is automatically called if the request succeeds and return type is JSON.
- Function $container.nosAjaxError() is automatically call if the request fails.
$(domContext).nosAjax({ dataType: 'json', // datatype is default 'json'. type: 'POST', // The request is made in POST by default. data: {} });
- options (JSON) –
nosAjaxSuccess¶
- $container.nosAjaxSuccess(options)¶
Process JSON of a succeeded AJAX request.
Arguments: - options (JSON) –
notify: A string or [string]. Use for call $.nosNotify(). error: A string or [string]. Use for call $.nosNotify() with error for notification type. action: A string or [string]. Use for call $container.nosAction(). closeDialog: Boolean. If true, call nosDialog.close(). closeTab: Boolean. If true, call nosTabs.close(). replaceTab: {}. Use to call nosTabs.update(). redirect: string. Redirect browser window to this URL. dispatchEvent: Use to call $container.dispatchEvent(). internal_server_error: Display error and backtrace in the browser console.
- options (JSON) –
nosAjaxError¶
- $container.nosAjaxError(jqXHR, textStatus)¶
Process a failed AJAX request.
Display the reconnection popup if the error comes to an end of the authentication session.Display a notification otherwise.Arguments: - jqXHR (jqXHR) – An XMLHttpRequest object.
- textStatus (string) – Text status of the AJAX request.