How can I use php_ajax?

Hello,

by the custom buttons, you have a code example for php_standard.
But how works php_ajax?

Normaly I create an xmlhttp object an send the information to my php file, e.g:
[pre]
xmlhttp=new XMLHttpRequest();

url = new URL('https://www.demo.com/entwicklung/dadabik/include/custom_php_files/empfaenger.php' );
url.searchParams.set('q', 'Hallo');

xmlhttp.open("GET",url,true);
xmlhttp.send();

xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
document.getElementById("output").innerHTML=xmlhttp.response;
}
}
[/pre]

How can I write this code in DaDaBIK? Must I put this code in custom_functions.js?

Thanks!
Michael
 
Here my instance information:
[pre]
You are using DaDaBIK version 9.4-Monterosso enterprise,
PHP Version: 7.1.31
mysql version: 5.7.27
Web server: Apache
Client: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0
[/pre]
 

eugenio

Administrator
Staff member
Hello,
the way you write a php_ajax or php_standard button is exactly the same (only PHP code); it's DaDaBIK that, with php_ajax, uses an ajax call to execute your php code.

Best,
 
Top