My 1st and 2nd dropdowns have an onchange event defined. For example the 1st one (called ddlMarca) calls the function getModelos, which in turn calls createModelos.
Here's the code. Hope it helps to clear my question.
<code>
var ajax = new sack();
function getModelos(sel)
{
var IDMarca = sel.options[sel.selectedIndex].value;
//Empty model select box
document.getElementById('ddlModelo').options.length = 0;
if(IDMarca.length>0){
//Specifying which file to get
ajax.requestFile = 'getMV.php?IDMarca='+IDMarca;
//Specify function that will be executed after file has been found
ajax.onCompletion = createModelos;
ajax.runAJAX(); // Execute AJAX function
}
}
function createModelos()
{
var obj = document.getElementById('ddlModelo');
//Executing the response from Ajax as Javascript code
eval(ajax.response);
}
Bookmarks