1 (edited by trainer2008 08/24/2020 07:20:06 pm)

Topic: I want to understand how ajax is working here

Hi,
I have a hard time looking for how to use ajax in FA,

I read about $Ajax->activate() but I have doubts using it,

let us make a simple example so that it can be clear how it works.

say I started div with id mydiv, after that i have a function (named as myfunction) that I want it to fill the div with a some text data based on an input field value when I click a submit button.

What I need to understand how to link the submit button to execute the myfunction function by ajax to fill the mydiv div?

hope you understand my question.

Re: I want to understand how ajax is working here

https://frontaccounting.com/fawiki/index.php?n=Devel.AjaxInFA

Re: I want to understand how ajax is working here

Hi apmuthu,

I read this wiki, I did not get it clearly.

I want to know when you say for example $Ajax->activate('price');

then how it know the code that should be executed to get the content in the price field?

Re: I want to understand how ajax is working here

The files you will need to refer are:

includes/ajax.inc
includes/JsHttpRequest.php
js/JsHttpRequest.js

The functions in_ajax() and absolute_url($url) are outside of the extended class.

The various ajax trigger commands executed are for:

rd => redirect
pu => popup
js => javascript
as => assign
up => update
di => disable target / enable target
fc => focus

There difference between the disable and enable methods for the "n='di'" command attribute is the boolean value of the argument $sData.