• jquery异步提交无刷新


    1、引用js文件:

     <script type="text/javascript" src="/JavaScript/jquery-1.2.6.pack.js"></script>

    2、编写js:

     //业务种类改变
            function sel_YWZL_Change(num)
            {
               var val = document.getElementById('GV_CommonData_ctl' + num + "_sel_YWZL").value;          
               var cx = document.getElementById('GV_CommonData_ctl' + num + "_sel_FYMC");   
               $.ajax({ type: "get", dataType: "html", url: "GetSFLC.aspx?YWZL="+encodeURI(val)+"&timestamp=" + new Date().getTime(), data: "", success: function(data)
                {
                    func_getCX(data,cx);
                }});          
            }
           
            //返回结果调用js

            function func_getCX(fyxm, obj)
            {
                var arrsel = fyxm.split(',');
                var alen = arrsel.length;
                obj.options.length = 0;       
                var count = 0;          
                for(var i = 0; i < alen; i++)
                {
                    obj.options.add(new Option(arrsel[i].toString(),arrsel[i].toString()));
                    if(obj.options[i].value != "运费")
                        count = count+1;
                } 
       
                if(count == alen)
                {
                    obj.options.add(new Option("运费","运费"));               
                }
                obj.value = "运费";
           }

    3、新建异步调用页面:GetSFLC.aspx

     if (Request["YWZL"] != null && Request["YWZL"].ToString() != string.Empty)
            {
                string ywzl = Request["YWZL"].ToString();
                DataSet ds_fymc = new DataSet();
                if (ywzl == "不限")
                {
                    ds_fymc = _BasicDAL.GetProc("select FYXM from YWLXFYXMSZ where YWLX='运输'");
                }
                else
                {
                    ds_fymc = _BasicDAL.GetProc("select FYXM from YWLXFYXMSZ where YWZL='" + ywzl + "' and YWLX='运输'");
                }
                if (ds_fymc != null && ds_fymc.Tables.Count > 0)
                {
                    string[] DDParm = new string[] { "FYXM" };
                    DataTable dt = _gl.DefinitionTable(DDParm);
                    string fy = "";
                    for (int s = 0; s < ds_fymc.Tables[0].Rows.Count; s++)
                    {
                        fy += ds_fymc.Tables[0].Rows[s][0].ToString().TrimEnd(',') + ',';
                    }
                    string[] fyxms = fy.TrimEnd(',').Split(',');
                    for (int g = 0; g < fyxms.Length; g++)
                    {
                        DataRow dr = dt.NewRow();
                        dr["FYXM"] = fyxms[g].ToString();
                        dt.Rows.Add(dr);
                    }
                    DataTable dft = dt.DefaultView.ToTable(true, "FYXM");
                    string fym = "";
                    for (int x = 0; x < dft.Rows.Count; x++)
                    {
                        fym += dft.Rows[x][0].ToString() + ',';
                    }
                    Response.Write(fym.TrimEnd(','));
                }
                else
                {
                    Response.Write("");
                }
            }

     Response.End();
          

  • 相关阅读:
    [问题2014S12] 复旦高等代数II(13级)每周一题(第十二教学周)
    [问题2014S09] 解答
    [问题2014S11] 复旦高等代数II(13级)每周一题(第十一教学周)
    [问题2014S08] 解答
    [问题2014S10] 复旦高等代数II(13级)每周一题(第十教学周)
    [问题2014S07] 解答
    [问题2014S09] 复旦高等代数II(13级)每周一题(第九教学周)
    [问题2014S08] 复旦高等代数II(13级)每周一题(第八教学周)
    怎么解决tomcat占用8080端口问题图文教程
    MySQL中删除重复数据只保留一条
  • 原文地址:https://www.cnblogs.com/shinggang/p/1999572.html
Copyright © 2020-2023  润新知