App Builder \ PfJs Helper Class

Ajax | PfJs.ajaxCall(screenIdent, data, okfunc, errfunc)

App Builder & Automation Expert

Stay Updated with ProcFu!

Subscribe to our newsletter for the latest tips, updates, and automation insights.

Subscribe Now
PfJs.ajaxCall(screenIdent, data, okfunc, errfunc);

This function is used to simulate an AJAX call in the application. It is particularly useful for fetching data from the server without refreshing the page. It takes four arguments:

Arguments

  • screenIdent: The unique identifier of the screen where the data will be displayed.
  • data: The data object to be sent to the server. For example: {ids: [1, 2]}. Note that this data is sent as URL parameters.
  • okfunc: The function to execute if the AJAX call is successful.
  • errfunc: The function to execute if the AJAX call fails.

How It Works

You can make an AJAX request from the On-Render event of a screen using this function. To handle the request, you need to create another screen that processes the data. This second screen is not displayed in the application and is purely for backend processing.

In the before-process event of this backend screen, you'll fetch the data sent from the first screen via its URL parameters. Using any of ProcFu's built-in functions, you can query and process the data, then return it by printing the results. This data is sent back to the first screen as a response.

The okfunc function is executed when the data is successfully returned from the server. The errfunc function is executed if the server returns an error.

Example

This guide provides several tips and tricks to help you use this function effectively. Here are two examples:

Love using ProcFu Guide?

Share your testimonial and let us know how ProcFu has helped you.

Share Your Testimonial

Built with ❤️ by Thaha for the Community