码迷,mamicode.com
首页 > Web开发 > 详细

jquery ajax无刷新删除

时间:2014-05-24 04:34:29      阅读:324      评论:0      收藏:0      [点我收藏+]

标签:des   class   blog   c   code   java   

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

点击简历的数量,弹出层(用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无刷新删除

标签:des   class   blog   c   code   java   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!