jQurey代碼部分:
創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比蒲縣網(wǎng)站開(kāi)發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫(kù),直接使用。一站式蒲縣網(wǎng)站制作公司更省心,省錢(qián),快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋蒲縣地區(qū)。費(fèi)用合理售后完善,十載實(shí)體公司更值得信賴。
HTML代碼部分:
SupplyAJAX類
- public partial class SupplyAJAX : System.Web.UI.Page
- {
- static List
UmList = new List (); - protected void Page_Load(object sender, EventArgs e)
- {
- switch (Request.QueryString["type"])
- {
- case "add":
- Add();
- break;
- case "update":
- Update();
- break;
- case "delete":
- Delete();
- break;
- }
- Response.End();
- }
- private string Add()
- {
- UserModel um = new UserModel();
- um.Id = UmList.Count + 1; //自動(dòng)為ID加1
- um.Username = Request.Form["username"];
- um.Seltype = Request.Form["seltype"];
- UmList.Add(um);
- return um.Id.ToString();
- }
- private string Update()
- {
- int id = int.Parse(Request.QueryString["id"]);
- for (int i = 0; i < UmList.Count; i++)
- {
- if (id == UmList[i].Id)
- {
- UmList[i].Username = Request.Form["username"];
- UmList[i].Seltype = Request.Form["seltype"];
- return UmList[i].Id.ToString();
- }
- }
- return "0";
- }
- private string Delete()
- {
- int id = int.Parse(Request.Form["id"]);
- for (int i = 0; i < UmList.Count; i++)
- {
- if (id == UmList[i].Id)
- {
- UmList.Remove(UmList[i]);
- return UmList[i].Id.ToString();
- }
- }
- return "0";
- }
- }