Hi,
nuBuilderPro has a nuAjax function:
function nuAjax(pCode, pFunctionName, pOptions)
"This function runs the PHP Function in pCode and optionally runs a Javascript function using the set value of $nuParameters within the PHP Function as a parameter"
http://wiki.nubuilder.net/nubuilderv3/i ... Name.5D.29
How can I use it in nuBuilderForte? I don't see any information on the nuBuilderForte wiki page.
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
nuAjax
Re: nuAjax
toms,
Good question.
You can use nuRunPHPHidden()...
http://wiki.nubuilder.net/nubuilderfort ... nPHPHidden
It will run a Procedure without opening another Browser window.
You can use nuJavascriptCallback() inside that Procedure to run Javascript after the Procedure is complete...
http://wiki.nubuilder.net/nubuilderfort ... ptCallback
Steven
Good question.
You can use nuRunPHPHidden()...
http://wiki.nubuilder.net/nubuilderfort ... nPHPHidden
It will run a Procedure without opening another Browser window.
You can use nuJavascriptCallback() inside that Procedure to run Javascript after the Procedure is complete...
http://wiki.nubuilder.net/nubuilderfort ... ptCallback
Steven
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am
Re: nuAjax
I don't quite understand how to use this nuJavascriptCallback() - probably due to the lack of profound js-knowledge.
My goal is to build a cascaded dropdown as shown in this example (for v3)
http://forums.nubuilder.cloud/viewtopic.p ... jax#p14320
Following the example, I created a PHP Procedure with the code "find_models".
In a dropdown, I attached an onchange event handler that runs the procedure:
Where and how exactly do I implement nuJavascriptCallback()? The pollute_models() should be called after nuHiddenPHP() has returned from the server, passing the param.
My goal is to build a cascaded dropdown as shown in this example (for v3)
http://forums.nubuilder.cloud/viewtopic.p ... jax#p14320
Following the example, I created a PHP Procedure with the code "find_models".
In a dropdown, I attached an onchange event handler that runs the procedure:
Code: Select all
nuRunPHPHidden("find_model");
Code: Select all
function pollute_models(param){
$('#car_model').empty();
$('#car_model').append('<option value=""></option>');
if(param!=''){
var json_data = JSON.parse(param);
for(var i=0; i < json_data.length;i++){
$('#car_model').append('<option value="'+json_data[i][0]+'">'+json_data[i][1]+'</option>');
}
}
}
Re: nuAjax
toms,
Here is a Procedure that will populate a Select Object called thelist based on an Object called thelanguage
It makes Javascript and runs it back in the Browser.
Steven
Here is a Procedure that will populate a Select Object called thelist based on an Object called thelanguage
It makes Javascript and runs it back in the Browser.
Code: Select all
$a = [];
$s = "SELECT * FROM zzzzsys_translate WHERE trl_language = '#thelanguage#'";
$t = nuRunQuery($s);
while($r = db_fetch_object($t)){
$a[] = $r->trl_english;
}
$j = json_encode($a);
$js = "
populate_phrases();
function populate_phrases(){
var p = $j;
$('#thelist').empty();
if(p != ''){
for(var i = 0; i < p.length;i++){
$('#thelist').append('<option value=\"' + p[i] + '\">' + p[i] + '</option>');
}
}
}
";
nuJavascriptCallback($js);
Steven
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am