Requester

The Requester module in ReqEase plays a pivotal role in managing HTTP requests, handling responses, and coordinating various aspects of your web application. It consists of three primary sub-modules: Loading Indicator, HTTP Request, and HTTP Response.

Modules

  • Loading Indicator

The Loading Indicator is the first step in the Requester module. It helps manage the visual loading state of your application during HTTP requests. When an action that requires an HTTP request is initiated, such as form submission, ReqEase can display a loading indicator to signal that a process is in progress.

  • HTTP Request

The HTTP Request sub-module is responsible for initiating and configuring AJAX requests to your server. It uses jQuery's AJAX capabilities under the hood, making it highly customizable and powerful. ReqEase's flexibility ensures that you can tailor these requests to suit your specific needs.

  • HTTP Response

Once an HTTP request is made and a response is received from the server, the HTTP Response sub-module takes charge. It handles the processing of the response data and manages how it's displayed or utilized within your web application.

Requester Options

Now, let's explore the various options available for configuring the Requester module:

  • form: A reference to the HTML form element. It helps ReqEase identify the form associated with the request.

  • okBtn: A reference to the HTML button element that triggers the request, typically associated with form submission.

  • useReadyModal: Specifies the type or label of modal handler to use during the request process. It can be a string, ModalHandlerType, or set to false if no modal should be displayed.

  • fields: Defines the HTML elements or fields involved in the request. You can specify them manually or set it to 'auto' to let ReqEase determine the relevant fields automatically.

  • requestData: The data to be sent in the request. It can be a record of key-value pairs or a function that provides this data.

  • loading: Options for configuring the loading indicator, such as its appearance and behavior.

  • modalHandlersToRegister: An array of custom ModalHandler classes that can be used to create custom modals during the request process.

  • intendedRedirect: Specifies where the user should be redirected after the request is complete. This can be a URL, a function returning a URL, or a string starting with "key:" that corresponds to a predefined redirect.

  • intendedRedirectPriority: A boolean value indicating whether the intended redirect should take priority over other redirects.

  • request: Options related to configuring the HTTP request, such as HTTP method, headers, and more.

  • response: Options related to handling the HTTP response, including status code validation and response data processing.

  • strings: Customize the text and messages displayed during the request process, such as error messages and validation feedback.

  • showConfirmModal: Determine whether to show a confirmation modal before executing the request.

These options provide granular control over how the Requester module behaves within your ReqEase-powered web application. You can fine-tune each aspect to match your specific requirements.

Form and OkBtn Configuration

Like we saw on Form Validator. form and okBtn are defined by ReqEase module, but you can customize them in case Requester is used alone without ReqEase.

Last updated