jquery ajax无刷新删除
职位列表里面显示应聘的简历:
点击简历的数量,弹出层(用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); } } |
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。