您的位置:首页 > 其它

结合三层,使用存储过程与JQ实现下拉框的联动

2014-06-10 15:43 323 查看
前台代码略;

JS端:

function createTag(parentTagId, childTag) {

var thisObj = document.createElement(childTag);

var parent = document.getElementById(parentTagId);

parent.appendChild(thisObj); return thisObj;

}

function FirstModel() {

var FirstModel = $("#SelectFirst")[0].value;

var Site = $("#seCompanyCode")[0].value;

$.ajax({

type: "get",

cache: false,

dataType: "Json",

url: "../forms/handler/SecondModel.ashx",

data: {

FirstModel: FirstModel,

Site: Site

},

beforeSend: function (XMLHttpRequest) { },

success: function (data, textStatus) {

if (data) {

var selectSecond = $("#SelectSecond");

selectSecond.empty();

var jsonObject = eval(data.Table);

for (var i = 0; i < jsonObject.length; i++) {

var createObj = createTag('SelectSecond', 'option');

createObj.value = jsonObject[i].numbers;

createObj.Text = jsonObject[i].notects;

createObj.innerText = jsonObject[i].notects;

}

}

},

complete: function (data, textStatus) { },

error: function () { }

});

}

ashx端:

public string GetResult(HttpContext context) {

System.Data.DataSet DS = new System.Data.DataSet();

HttpRequest Request = context.Request;

string firstModel = Request.QueryString["FirstModel"];

string Site = Request.QueryString["Site"];

ContractBLL bll = new ContractBLL();

DS = bll.LoadSecodModel(firstModel,Site);

return MyJson.DataTable2Json(DS.Tables[0]);

}

CS端略
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐