Hi,
I have a combobox that need to have its items populated based on the results from a web service. I did try the below and could not get it working. Help appreciated.
Below is the javascript i use to get the information from a web service.
The alert with "success" message is never called but from fiddler i get a 200 Http status code. The WCF service method returns a list of string. Below is the raw response from fiddler:
Additionally i did remove the dataType setting in the ajax call and resulted in the same. Also i did add an error setting with an alert and have this popup on my screen even though Fiddler reported a 200 OK status with the data.
I have a combobox that need to have its items populated based on the results from a web service. I did try the below and could not get it working. Help appreciated.
<
telerik:RadComboBox
ID
=
"radTestCombo"
runat
=
"server"
EnableLoadOnDemand
=
"true"
EnableItemCaching
=
"true"
WebServiceSettings-UseHttpGet
=
"true"
OnClientLoad
=
"GetServers"
Label
=
"Servers"
>
</
telerik:RadComboBox
>
Below is the javascript i use to get the information from a web service.
function
GetServers(sender, eventArgs) {
combo = sender;
combo.trackChanges();
$.ajax({
dataType:
'json'
,
type:
"GET"
,
success:
function
(data) {
alert(
'success'
);
$.each(data,
function
(i, val) {
var
comboItem =
new
Telerik.Web.UI.RadComboBoxItem();
alert(comboItem);
comboItem.set_text(val.toString());
combo.get_items().add(comboItem);
});
}
});
combo.commitChanges();
alert(combo.get_items().get_count());
}
The alert with "success" message is never called but from fiddler i get a 200 Http status code. The WCF service method returns a list of string. Below is the raw response from fiddler:
HTTP/1.1 200 OK
Content-Length: 602
Content-Type: application/json; charset=utf-8
Date: Thu, 12 Jul 2012 15:34:46 GMT
["John","Smith","Charlie","DAVID","James","Bond"]
Additionally i did remove the dataType setting in the ajax call and resulted in the same. Also i did add an error setting with an alert and have this popup on my screen even though Fiddler reported a 200 OK status with the data.