Dear Experts,
I am Using Ajax Json in asp.net. Here is the below code of Ajax Json that i am used......
$.ajax(
{
type: "POST",
url: "../../WebService.asmx/populate_Country",
dataType: "json",
data: {},
contentType: "application/json; charset=utf-8",
success: function (json) {
var xmlDoc = "";
var xml = "";
xmlDoc = $.parseXML(json.d);
xml = $(xmlDoc);
document.getElementById("ddl_Country").innerHTML = "";
$(xml).find("Table1").each(function () {
var County_ID = $(this).find("Country_ID").text();
var County_Name = $(this).find("Country").text();
var County_Selected = $(this).find("Default_Selection").text();
$("#ddl_Country").append("<option value='" + County_ID + "' selected='" + County_Selected + "'>" + County_Name + "</option>");
});
}
});
And here is the below HTML Code,
<select id="ddl_Country" name="validation-select" class="select expandable-list validate[required]">
</select>
And these are the datas from database..
Country_ID Country Default_Selection
1 Canada NULL
2 United States NULL
3 Belgium NULL
4 Australia NULL
5 New Zealand NULL
6 India Selected
And i want to populate these datas in dropdownlist....
These codes are working fine, but Country India is not selected......
When i hard coded these datas in the source, then the India will be selected...
Please Help me..
Thanks and Regards,
Dileep..