日期:2014-05-17 浏览次数:20609 次
$("#<%= ddlProvince.ClientID %>").change(function () {
var parent = $(this).val();
$.ajax({
url: 'GetRegionList.ashx?Parent=' + parent + '&Type=1',
type: "get",
success: function (str) {
$("#<%= ddlCity.ClientID %>").empty();
var names = eval(str);
for (var i = 0; i < names.length; i++) {
$("#<%= ddlCity.ClientID %>").append($("<option value='" + names[i].ID + "'>" + names[i].Name + "</option>"));
}
}
});
});
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string strParent = context.Request.QueryString["Parent"].ToString();
string strType = context.Request.QueryString["Type"].ToString();
DataTable dtNames = DbHelper.GetRegionNames(strParent, strType);
context.Response.Write(TransformJson(dtNames));
context.Response.End();
}
private string TransformJson(DataTable dtNames)
{
StringBuilder Json = new StringBuilder();
Json.Append("[");<