views:

34

answers:

1

I have this code fragment

var combo = new dhtmlXCombo("combo_zone4", "alfa4", 230);
    combo.loadXML("create_store2.php");
    combo.attachEvent("onChange", onChangeFunc);
    combo.enableFilteringMode(true, "select_store.php");
    function onChangeFunc() {
        var d=combo.getSelectedValue();
        var product=$("#selProduct");
        product.find('option').remove();

        $.ajax({
            url: "select_store2.php",
            data: "store=" + d,

My questions are what are those 3 files used for, and why we need three different files to be called.

Fragment 1:

combo.loadXML("create_store2.php");

create_store2 seams it returns some XML data, some <option> tags.

Fragment 2:

combo.enableFilteringMode(true, "select_store.php");

select_store seams it returns some XML data, some <option> tags.

Fragment 3:

url: "select_store2.php",

select_store2 seams it returns some JSON data, this is probably the result of the autocomplete call.

A: 

I never used the dhtmlx components but the API does give off some serious red flags, data can really only be loaded with xml responses ?

Here's what I gathered from the API.

loadXML loads additional options from an XML file (i take it you can set these in script too)

enableFilteringMode enables suggestions as you type, i think the create_store2.php call in loadXML gives the combo also its initional data set.

the jquery ajax call I presume changes the contents of a combo box with the values supplied by select_store2.php filtered by the selected value of combo but i'd need to see the rest of the code to know for sure. Since this is jquery this data is returned in json and I presume manually processed later on in the code.

Martijn Laarman