DEV Community

Cover image for AJAX in Elanat framework
elanatframework
elanatframework

Posted on

AJAX in Elanat framework

Sending and receiving data in Elanat is done through a JavaScript function called el_AjaxPostBack. The el_AjaxPostBack function has extensive features and you don't need to be involved in the complexities of receiving and transferring data with Ajax.

You can add el_AjaxPostBack function in your add-ons.
This function exist in global.js file in:
/client/script/global.js

This function consists of 4 arguments as follows :

el_AjaxPostBack(obj, FetchScript, PostbackSectionId, Retrieved)
Enter fullscreen mode Exit fullscreen mode

obj should be the value of this.
FetchScript is a boolean variable that, if its value is true, calls the scripts read by AJAX.
PostbackSectionId is a string that, if the name of an ID is written in the tags on the page, the returned value will be added as AJAX at the beginning of the tag.
Retrieved is a boolean variable that, if its value is true, replaces the tags inside the PostbackSectionId tag with the AJAX return value; If PostbackSectionId is not used, it will include the tag named div_PageLoad, and if this tag is missing, it will include the body tag of the HTML page.
Note:

If the value use_retrieved=true exists in the querystring, the Retrieved variable will be activated.

The HTML code below is an example of using this function in a button and sending it as AJAX.

<form method="post" action="/">

    Name:
    <input name="txt_Name" type="text">

    Email:
    <input name="txt_Email" type="text">

    Phone number:
    <input name="txt_Phonenumber" type="text">

    <input name="btn_Send" type="submit" value="send" onclick="el_AjaxPostBack(this)">

</form>
Enter fullscreen mode Exit fullscreen mode

Top comments (0)