首页 > Web开发 > 详细

jquery ajax无刷新删除

时间:2014-05-24 04:31:55      阅读:475      评论:0      收藏:0      [点我收藏+]

职位列表里面显示应聘的简历:

点击简历的数量,弹出层(用load方法调用加载)

弹出的层里面删除简历(无刷新删除),实现方法

1
2
3
4
5
6
7
8
9
10
11
12
$(".Del a").click(function () {
            var mid = $(this).attr("name");  
            var jobid = $(this).attr("lang"); //职位id
            $.get("CompanyAcept.aspx", { Mid: mid }, function (data) {
                if (data == "1") {
                //如果后台删除成功,load方法加载本页面,实现无刷新删除
                    $("#conter1").load("CompanyAcept.aspx", { jobid: jobid }, function () {
                        alert(‘删除成功‘);
                    })
                }
            }, "text");
        })

  后台:

1
2
3
4
5
6
7
8
9
10
11
if (Request.QueryString["Mid"] != null && Session["comid"] != null)
            {
                string mid = Request.QueryString["Mid"];
                string strDel = "Delete [bst_Company_ResumeAccept] Where Comid=‘" + Session["comid"].ToString() + "‘ and Username=‘" + Session["UserName"].ToString() + "‘ And Mid=" + mid;
                bool bl = hxrcsc_BLL.UpData.ExecuteNonQuery(strDel);
                if (bl)
                {
                    Response.Write("1");
                    Response.End();
                }
            }

  后台返回的是"1"

前台判断如果返回的是"1",load方法加载本页面去绑定数据,因为用Repeater数据绑定控件,从而实现删除,数据消失

1
2
3
4
5
6
7
$.get("CompanyAcept.aspx", { Mid: mid }, function (data) {
               if (data == "1") {
               //如果后台删除成功,load方法加载本页面,实现无刷新删除
                   $("#conter1").load("CompanyAcept.aspx", { jobid: jobid }, function () {
                       alert(‘删除成功‘);
                   })
               }

  后台:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
string jobid = "";
           if (Request.Form["jobid"] != null)
           {
               jobid = Request.Form["jobid"];
               string comid = Session["comid"].ToString();       //
               string username = Session["UserName"].ToString(); //
               string sql = "Select a.Mid,a.Comid,a.Username,a.Jobid,a.Perid,a.Resid,a.LetterDesc,a.VisitSign,Convert(varchar(10),a.ApplyDate,120) as ApplyDate,a.ApplyClick,a.ResumeLanguage,a.RealName,a.Sex,a.BirthDate,a.Degree,a.PhotoUrl,a.PhotoKeep,a.VideoFlag,a.JobName From bsv_Company_ResumeAccept_List a inner join bst_Person_Basic b on b.perid=a.perid  Where a.Comid=‘"+comid+"‘ And a.Username=‘"+username+"‘ And a.jobid=‘" + jobid + "‘";
               DataTable dt = hxrcsc_BLL.PersonMsg.Query(sql);
               if (dt.Rows.Count > 0)
               {
                   lblJobName.Text = dt.Rows[0]["JobName"].ToString();
                   Label1.Text = dt.Rows.Count.ToString();
                   binDt(dt,6);
               }
           }

  

 

jquery ajax无刷新删除,布布扣,bubuko.com

jquery ajax无刷新删除

原文:http://www.cnblogs.com/jiaqi/p/3736569.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!