1

I want to call a web service and use it in combox for search. Here is the function that i used to call my service web:

var xmlhttp = new XMLHttpRequest();
var url = "http://176.31.230.211/mtmap/MapSrv.svc/getCities";
var params = JSON.stringify({
    sessId:"1",
    cityName:"ra"
});
xmlhttp.open("POST", url, true);

xmlhttp.setRequestHeader("Content-type", "application/json");

xmlhttp. önreadystatechange = function() {
        if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                console.log(xmlhttp.responseText);
        }
}
xmlhttp.send(params);

I created the ComboBox using the GeoExt bibliography:

var promosCombo = new Ext.form.ComboBox({   
 id : 'promosCombo',
 triggerAction : 'all',
 emptyText : "Ville, Avenue, Rue...",
 editable : false,
 store : promosStore,
 mode : 'local',
 valueField : 'value',
 displayField : 'display',
});

here is my store:

var promosStore = new Ext.data.JsonStore({
 url : 'http://176.31.230.211/mtmap/MapSrv.svc/getCities',
 fields : ['display', 'value'],
 root : 'rows',
 autoLoad : true
});

What i want exactly is when i start to tape in my ComboBox the list of the city appear so i can choose the city.

  • a3ni what do you mean? – Hamri Said Mar 21 '17 at 19:09