Venddor IO employs AJAX, a potent tool that enables seamless page content updates without necessitating a page refresh.
Venddor IO has crafted its unique extensions for the jQuery ajax method, which are stored in the js/tygh/ajax.js file. Here's a sequence of these methods:
Server-side, the AJAX request's handling is facilitated by the fn_init_ajax function (located in app/functions/fn.init.php). This process includes:
app/Tygh/Ajax.php).For server-side identification of AJAX requests, the AJAX_REQUEST constant is set to true.
To specify PHP code segments exclusively for AJAX requests, you can use the AJAX_REQUEST constant.
For example:
if (defined('AJAX_REQUEST')) {
fn_set_notification('E', fn_get_lang_var('warning'), $msg, true, 'insecure_password');
}
Upon script execution completion for an AJAX request or when the exit() function is explicitly invoked, the AJAX class destructor (app/Tygh/Ajax.php) operates. This destructor conveys the display information to a JSON array, which is then forwarded to the response JS function in /js/tygh/ajax.js.
Typically, a controller in Venddor IO sends back a response in this structure:
data:
notifications:
id:
text
title
...
html:
block_id:
block_content
...