ajax+json+ashx实现一个页面多个tab的分页
1:项目功能需求:我的荣誉、审核中的荣誉、审核通过的荣誉在一个页面分别作列表展示。每个tab都需要分页,对实现的功能做个简单总结。
2:前台页面:引用的DBPage.js和pageCss.css实现分页,tab之间的切换未放在代码里面。
script type="text/javascript" src="<%=Epoint.EduFront.Bizlogic.CommFun.GetCommonRecourceDirectory()%>/Scripts/DBPage.js"></script>
<link href="<%=Epoint.EduFront.Bizlogic.CommFun.GetCommonRecourceDirectory()%>/Style/Common/Theme1/css/pageCss.css" rel="stylesheet" /> <script type="text/javascript">
//用户ID
var UserGuid = "<%=UserGuid%>";
//是否外部访问,如果外部访问则只显示申请通过的荣誉(我的荣誉)
var ViewType = "<%=ViewType%>";
var Ajaxurl = Common.GlobalSettings.VirtualDirectory + "/ashx/Honor.ashx"; //获取我的各类型荣誉数量
function getHonorCount(type) {
jQuery.ajax({
url: Ajaxurl,
type: "post",
//获取我的荣誉总数量
//data: { 'control': 'posts', 'op': 'count', 'posttype': 'personal', 'categoryguid': categoryguid, 'id': UserGuid, 'codevalue': PostCodeValue },
data: { 'control': 'honorcount', 'type': type, "userid": UserGuid },
dataType: "text",
success: function (data) {
if (data != "") {
//数量大于零,显示对应列表
if (type == '') {
//01为审核中
getHonorList(, data, , "HonorApplyingListBox", "true", "pager2", type, UserGuid);
}
else if (type == '') {
//审核通过
getHonorList(, data, , "HonorListBoxListBox", "true", "pager1", type, UserGuid);
} else if (type == '') {
//审核未通过
getHonorList(, data, , "HonorRefusedListBox", "true", "pager3", type, UserGuid);
} }
else {
if (type == '') {
$("#HonorListBoxListBox").html("<div style='text-align:center;'>暂无数据~<div>");
}
else if (type == '') {
$("#HonorApplyingListBox").html("<div style='text-align:center;'>暂无数据~<div>");
}
else if (type == '') {
$("#HonorRefusedListBox").html("<div style='text-align:center;'>暂无数据~<div>");
}
}
},
error: function (XMLHttpRequest, txtStatus, errorThrown) {
Common.ErrorHandle(XMLHttpRequest.status + "|" + XMLHttpRequest.readyState + "|" + txtStatus + "|" + errorThrown);
Common.ErrorHandle("HonorApplyList.ascx");
}
});
}
//根据用户guid,和type获取荣誉列表
function getHonorList(PageIndex, total, spanInterval, contentid, allowpagging, pagerId, type, userguid) {
jQuery.ajax({
url: Ajaxurl,
type: "post",
//获取我的荣誉列表
data: { 'control': 'honorList', 'type': type, 'userid': userguid, 'PageIndex': PageIndex, 'spanInterval': spanInterval },
dataType: "json",
success: function (jdata) {
if (jdata.status == "success") {
//创建荣誉列表
createHonorList(type, jdata.data, contentid);
if (allowpagging == "true") {
//是否允许分页
Paging(PageIndex, total, spanInterval, pagerId);
}
}
},
error: function (XMLHttpRequest, txtStatus, errorThrown) {
Common.ErrorHandle(XMLHttpRequest.status + "|" + XMLHttpRequest.readyState + "|" + txtStatus + "|" + errorThrown);
Common.ErrorHandle("HonorApplyList.ascx");
}
});
}
//根据荣誉数据,创建荣誉Html文本
function createHonorList(type, data, contentid) {
//alert(data);
var id = "#" + contentid;
$(id).html("");
var table = "<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr style='font-size: 14px; font-weight: bold;color:#CA7733'><td height='26' class='list'>荣誉称号</td><td width='150' align='center'>荣誉等级</td><td width='150' align='center'>授予部门</td><td width='150' align='center'>获得时间</td></tr>"; for (var i = ; i < data.length; i++) {
var s = "<tr>";
s += "<td height='26' class='list'>" + data[i].HonorTitle + "</td>";
s += "<td width='150' align='center'>" + data[i].HonorLevel + "</td>";
s += "<td width='150' align='center'>" + data[i].grantdepartment + "</td>";
s += "<td width='150' align='center' class='line4'>" + data[i].granttime + "</td>";
s += "</tr>";
table += s;
}
if (data.length > ) {
table += "</table>";
$(id).append(table);
}
else {
$(id).html("暂无数据~");
}
}
//页面初始化
$(function () {
if (ViewType == "inter") {
//如果是本人
getHonorCount("");
getHonorCount("");
getHonorCount("");
}
else {
$("#menu_2_1").html("荣誉");
$("#menu_2_2").hide();
$("#menu_2_3").hide();
$("#Honorapply").remove();
getHonorCount("");
//个人公开文章分页
//如果是教师、则查询特定分类的文章
} }),
//点击事件,根据不同身份,不同访问方式获取文章列表
//韦田野 2016-3-11修改
PageClick = function (pageIndex, total, spanInterval, pagerId) {
if (pagerId == "pager1") {
getHonorList(pageIndex, total, spanInterval, "HonorListBoxListBox", "true", pagerId, "", UserGuid);
}
else if (pagerId == "pager2") {
getHonorList(pageIndex, total, spanInterval, "HonorApplyingListBox", "true", pagerId, "", UserGuid);
}
else if (pagerId == "pager3") {
getHonorList(pageIndex, total, spanInterval, "HonorRefusedListBox", "true", pagerId, "", UserGuid);
}
}
</script> <div class="three">
<div class="head">
<div class="menub1_1" style="width: auto; font-size: 18px; margin-right: 15px;" id="menu_2_1" onmouseover="showtabs(2,1,3);">我的荣誉</div>
<div class="menub1_2" style="width: auto; font-size: 18px; margin-right: 15px;" id="menu_2_2" onmouseover="showtabs(2,2,3);">审核中的荣誉</div>
<div class="menub1_2" style="width: auto; font-size: 18px; margin-right: 15px;" id="menu_2_3" onmouseover="showtabs(2,3,3);">审核未通过</div>
<div style="float: right; font-size: 18px; margin-top: 15px;" id="Honorapply">
<a id="LinkHonorPublish" class="publishbtn" runat="server" href='' target="_blank">荣誉申请</a>
</div>
</div>
<div class="content" style="min-height: 410px;">
<div class="menugtab" id="menutab_2_1">
<div id="HonorListBoxListBox" style="min-height: 380px;"> </div>
<div class="yahoo2" id="pager1" ></div>
</div>
<div class="menugtab" id="menutab_2_2" style="display: none;">
<div id="HonorApplyingListBox" style="min-height: 380px;">
</div>
<div class="yahoo2" id="pager2"></div>
</div>
<div class="menugtab" id="menutab_2_3" style="display: none;">
<div id="HonorRefusedListBox" style="min-height: 380px;">
</div>
<div class="yahoo2" id="pager3"></div>
</div>
</div>
</div>
3:引用的DBpage.js和PageCss.css代码如下
DIV.yahoo2
{
padding: 3px;
MARGIN: 15px 3px 30px 3px;
font-family: 'Microsoft YaHei';
TEXT-ALIGN: center;
} DIV.yahoo2 A
{
border: 1px solid #dedede;
font-family: 'Microsoft YaHei';
font-size: 14px;
cursor: pointer;
margin: 2px;
color: black;
padding: 3px 13px;
} DIV.yahoo2 A:hover
{
background-color: #;
border: solid 1px #;
color: #FFFFFF;
} DIV.yahoo2 A:active
{
border: 1px solid #dedede;
font-weight: bold;
margin: 2px;
} DIV.yahoo2 SPAN.current
{
FONT-WEIGHT: bold;
COLOR: red;
margin: 2px;
PADDING: 3px 13px;
font-family: 'Microsoft YaHei';
font-size: 14px;
} DIV.yahoo2 SPAN.disabled
{
border: 1px solid #dedede;
font-family: 'Microsoft YaHei';
font-size: 14px;
/*font-weight: bold;*/
cursor: pointer;
width: 36px;
margin-left: 2px;
margin-right: 2px;
color: gray;
padding: 3px 13px;
} DIV.yahoo2 A.next
{
BORDER-RIGHT: #ccdbe4 2px solid;
BORDER-TOP: #ccdbe4 2px solid;
MARGIN: 0px 0px 0px 10px;
BORDER-LEFT: #ccdbe4 2px solid;
BORDER-BOTTOM: #ccdbe4 2px solid;
} DIV.yahoo2 A.next:hover
{
BORDER-RIGHT: #2b55af 2px solid;
BORDER-TOP: #2b55af 2px solid;
BORDER-LEFT: #2b55af 2px solid;
BORDER-BOTTOM: #2b55af 2px solid;
} DIV.yahoo2 A.prev
{
BORDER-RIGHT: #ccdbe4 2px solid;
BORDER-TOP: #ccdbe4 2px solid;
MARGIN: 0px 10px 0px 0px;
BORDER-LEFT: #ccdbe4 2px solid;
BORDER-BOTTOM: #ccdbe4 2px solid;
} DIV.yahoo2 A.prev:hover
{
BORDER-RIGHT: #2b55af 2px solid;
BORDER-TOP: #2b55af 2px solid;
BORDER-LEFT: #2b55af 2px solid;
BORDER-BOTTOM: #2b55af 2px solid;
} DIV.yahoo2 .jump_input
{
border: solid 0px #dfdfdf;
background-color: #ffffff;
/*border-bottom:solid 1px #dfdfdf*/
} .jump_input:focus {outline: none;} DIV.yahoo2 .jump_a
{
border: 1px solid #dedede;
font-family: 'Microsoft YaHei';
font-size: 14px;
font-weight: bold;
cursor: pointer;
width: 36px;
margin-left: 2px;
margin-right: 2px;
color: black;
padding-left: 10px;
padding-right: 10px;
} DIV.yahoo2 .jump_a:hover
{
border: 1px solid #dedede;
font-family: 'Microsoft YaHei';
font-size: 14px;
font-weight: bold;
cursor: pointer;
width: 36px;
margin-left: 2px;
margin-right: 2px;
color: black;
padding-left: 10px;
padding-right: 10px;
background-color: white;
}
function Paging(pageIndex, total, spanInterval, pagerId) { var pageS = total; if (pageS % spanInterval == ) pageS = pageS / spanInterval;
else pageS = parseInt(total / spanInterval) + ;
var $pager = $("#" + pagerId);
var intPageIndex = parseInt(pageIndex); //清除分页div中的内容
//$("#" + pagerId + " span").remove();
//$("#" + pagerId + " a").remove();
$pager.children().remove(); //添加第一页
//if (intPageIndex == 1)
// $pager.append("<span class='disabled'>第一页</span>");
//else {
// var first = $("<a href='javascript:void(0)' first='" + 1 + "'>第一页</a>").click(function () {
// PageClick($(this).attr('first'), total, spanInterval, pagerId,this);
// return false;
// });
// $pager.append(first);
//}
//添加上一页
if (intPageIndex == )
$pager.append("<span class='disabled'>< 上页</span>");
else {
var pre = $("<a href='javascript:void(0)' pre='" + (intPageIndex - ) + "'>< 上页</a>").click(function () {
PageClick($(this).attr('pre'), total, spanInterval, pagerId,this);
return false;
});
$pager.append(pre);
} //设置分页的格式 这里可以根据需求完成自己想要的结果 var interval = ; //设置间隔
var start = Math.max(, intPageIndex - interval); //设置起始页
var end = Math.min(intPageIndex + interval, pageS)//设置末页 if (intPageIndex < interval + ) {
end = ( * interval + ) > pageS ? pageS : ( * interval + );
} if ((intPageIndex + interval) > pageS) {
start = (pageS - * interval) < ? : (pageS - * interval); }
var console = console || { log: function () { } };
console.log("pageIndex:" + pageIndex + " total:" + total + " spanInterval:" + spanInterval + " start:" + start + " end:" + end);
//生成页码
for (var j = start; j < end + ; j++) {
if (j == intPageIndex) {
var spanSelectd = $("<span class='current'>" + j + "</span>");
$pager.append(spanSelectd);
} //if
else {
var a = $("<a href='javascript:void(0)'>" + j + "</a>").click(function () {
PageClick($(this).text(), total, spanInterval, pagerId, this);
return false;
});
$pager.append(a);
} //else
} //for //上一页
if (intPageIndex == pageS) {
$pager.append("<span class='disabled'>下页 ></span>"); }
else { var next = $("<a href='javascript:void(0)' next='" + (intPageIndex + ) + "'>下页 ></a>").click(function () {
PageClick($(this).attr("next"), total, spanInterval, pagerId, this);
return false;
});
$pager.append(next);
} //最后一页
//if (intPageIndex == pageS) {
// $pager.append("<span class='disabled'>最后一页</span>"); //}
//else {
// var last = $("<a href='javascript:void(0)' last='" + pageS + "'>最后一页</a>").click(function () {
// PageClick($(this).attr("last"), total, spanInterval, pagerId);
// return false;
// });
// $pager.append(last);
//} //跳转功能 var jump = "<span>" + pageIndex + "/" + pageS + " 转到</span>"
+ "<a class='jump_a'><input class='jump_input' style='width: 40px;margin-top: -3px;' type='text'></input></a>";
$pager.append(jump); var btn_go = $("<a href='javascript:;'>GO</a>").click(function () {
var $go=$("#" + pagerId + " .jump_input");
var goval = $go.val();
console.log(goval);
if (isNaN(Number(goval)) || goval == "" || goval > pageS || goval < ) {
$go.val("");
return;
}
console.log(goval);
PageClick(goval, total, spanInterval, pagerId, this);
return false;
});
$pager.append(btn_go); }
4一般处理程序 ashx页面代码
public class Honor : IHttpHandler
{ private HttpRequest Request = HttpContext.Current.Request;
public void ProcessRequest(HttpContext context)
{
Request = HttpContext.Current.Request;
string control = Request["control"].ToLower();
string result = "";
try
{
switch (control)
{
case "honortitle"://荣誉称号
result = this.GetHonorTitle("称号");
break;
case "rkxd"://任课学段
result = this.GetHonorTitle("任课学段");
break;
case "rjxk"://任教学科
result = this.GetHonorTitle("学科分类");
break;
case "honorlevel"://荣誉等级
result = this.getHonorLevelTree();
break;
case "honorcount"://荣誉数量
{
if (Request["userid"] != null && Request["userid"].ToString() != "")
{
//返回荣誉条数
result = GetHonorCount(Request["userid"].ToString(), Request["type"].ToString());
}
break;
}
case "honorlist"://荣誉列表
{
if (Request["userid"] != null && Request["userid"].ToString() != "")
{
//返回第N页对应类型荣誉数据
result = GetHonorList(Request["userid"].ToString(), Request["type"].ToString(), Request["PageIndex"].ToString(), Request["spanInterval"].ToString());
}
break;
} case "addhonor"://荣誉申请添加
{
if (Request["userid"] != null && Request["userid"].ToString() != "")
{
//进行插入操作
result = AddHonor(Request["userid"].ToString(), Request["txtGrantDepartment"].ToString(), Request["txtHonorTime"].ToString(), Request["txtRJXK"].ToString(), Request["txtRKXD"].ToString(), Request["txtOtherHonorTitle"].ToString(), Request["txtHonorTitle"].ToString(), Request["HonorLevel"].ToString());
}
break;
} }
}
catch (Exception e)
{
result = this.GetResult("", e.Message);
}
context.Response.ContentType = "text/plain";
context.Response.Write(result);
}
/// <summary>
/// 获取该用户对应类型的荣誉数量/// </summary>
/// <param name="userguid"></param>
/// <param name="honortype"></param>
/// <returns></returns>
public string GetHonorCount(string userguid, string honortype)
{
string sql = "select count(*) from honor where honorgainerguid = '" + userguid + "'and auditstate = '" + honortype + "'";
return Epoint.EduFront.Bizlogic.DB_Common.ExecuteToInt(sql).ToString();
}
/// <summary>
/// 获取分页荣誉称号列表/// </summary>
/// <param name="userguid"></param>
/// <param name="honortype"></param>
/// <param name="pageIndex"></param>
/// <param name="spanInterval"></param>
/// <returns></returns>
public string GetHonorList(string userguid, string honortype, string pageIndex, string spanInterval)
{
try
{
int pageStart = (Convert.ToInt32(pageIndex) - ) * Convert.ToInt32(spanInterval);
int pageEnd = Convert.ToInt32(pageIndex) * Convert.ToInt32(spanInterval);
string sql = string.Format(
"SELECT * FROM ( SELECT A.*, ROWNUM RN FROM (SELECT * FROM honor where honorgainerguid ='{0}' and auditstate ='{1}') A WHERE ROWNUM <= {2} ) WHERE RN > {3}", userguid, honortype, pageEnd, pageStart);
DataView dv = Epoint.EduFront.Bizlogic.DB_Common.ExecuteToDataView(sql);
StringBuilder sb = new StringBuilder();
sb.Append("[");
foreach (DataRowView dr in dv)
{
StringBuilder sb_SinglePost = new StringBuilder();
sb_SinglePost.Append("{");
//如果有选择了荣誉称号,则显示荣誉称号、否则显示其他荣誉称号
if (dr["HonorTitle"] != null && Convert.ToString(dr["HonorTitle"]) != "")
{
sb_SinglePost.Append(string.Format("\"{0}\":\"{1}\",", "HonorTitle",
GetCodetextByCodeValue("称号", dr["HonorTitle"].ToString())));
}
else
{
sb_SinglePost.Append(string.Format("\"{0}\":\"{1}\",", "HonorTitle",dr["OtherHonorTitle"].ToString()));
}
sb_SinglePost.Append(string.Format("\"{0}\":\"{1}\",", "HonorLevel",GetCodetextByCodeValue("荣誉等级", dr["HonorLevel"].ToString())));
sb_SinglePost.Append(string.Format("\"{0}\":\"{1}\",", "grantdepartment", dr["grantdepartment"].ToString()));
sb_SinglePost.Append(string.Format("\"{0}\":\"{1}\",", "granttime", dr["granttime"].ToString())); sb.Append(sb_SinglePost.ToString().TrimEnd(',') + "},");
}
string result = sb.ToString().TrimEnd(',') + "]";
return this.GetResult(result, "success"); }
catch (Exception e)
{
return "Error:" + e.Message;
}
} public string GetCodetextByCodeValue(string CodeName, string codevalue)
{
string sql = "select itemtext from code_items where codeid = (select codeid from code_main where codename ='" + CodeName + "') and itemvalue = '" + codevalue + "'";
return Epoint.EduFront.Bizlogic.DB_Common.ExecuteToString(sql);
}
/// <summary>
/// 申请荣誉记录添加/// </summary>
/// <param name="userid">用户guid</param>
/// <param name="txtGrantDepartment">授予部门</param>
/// <param name="txtHonorTime">授予时间</param>
/// <param name="txtRJXK">任教学科</param>
/// <param name="txtRKXD">任课学段</param>
/// <param name="txtOtherHonorTitle">其他荣誉名称</param>
/// <param name="txtHonorTitle">荣誉称号</param>
/// <returns></returns>
public string AddHonor(string userid, string txtGrantDepartment, string txtHonorTime, string txtRJXK, string txtRKXD, string txtOtherHonorTitle, string txtHonorTitle, string HonorLevel)
{
//根据用户UserGuid获取器所属学校信息
string Sql = "select XXGuid from jcxx_teacherinfo where rowGuid = '" + userid + "'";
try
{
string xxGuid = Epoint.EduFront.Bizlogic.DB_Common.ExecuteToString(Sql);
string honoraddSql = string.Format("insert into honor(operatedate,RowGuid,HonorTitle,otherhonortitle,honorlevel,RKXD,RJXK,GrantTime,GrantDepartment,Honorgainername,honorgainerguid,xxguid,auditstate)values(to_date('{0}','yyyy-mm-dd hh24:mi:ss'),'{1}','{2}','{3}','{4}','{5}','{6}',to_date('{7}','yyyy-mm-dd hh24:mi:ss'),'{8}','{9}','{10}','{11}','{12}')", DateTime.Now, Guid.NewGuid(), txtHonorTitle, txtOtherHonorTitle, HonorLevel, txtRKXD, txtRJXK, Convert.ToDateTime(txtHonorTime), txtGrantDepartment, GetTeacherNameByGuid(userid), userid, xxGuid, "");
Epoint.EduFront.Bizlogic.DB_Common.ExecuteNonQuery(honoraddSql);
return "申请成功!";
}
catch (Exception e)
{
return "Error:" + e.Message;
}
}
/// <summary>
/// 根据rowGuid查询用户姓名/// </summary>
/// <param name="rowguid"></param>
/// <returns></returns>
public string GetTeacherNameByGuid(string rowguid)
{
string sql = "select XM from jcxx_teacherinfo where rowguid= '" + rowguid + "'";
return Epoint.EduFront.Bizlogic.DB_Common.ExecuteToString(sql);
} /// <summary>
/// 荣誉等级信息初始化(荣誉等级分为两级)/// </summary>
/// <returns></returns>
public string getHonorLevelTree()
{
string Sql = "select itemtext,itemvalue from code_items where codeid = (select codeid from code_main where codename ='荣誉等级') and itemvalue like '__'";
//string childlevel = "select itemtext,itemvalue from code_items where codeid = (select codeid from code_main where codename ='荣誉等级') and itemvalue like '__'";
StringBuilder sb = new StringBuilder();
sb.Append("[");
DataView Firstlvdv = Epoint.EduFront.Bizlogic.DB_Common.ExecuteToDataView(Sql);
StringBuilder parentsb = new StringBuilder();
foreach (DataRowView drv in Firstlvdv)
{
parentsb.Append("{");
parentsb.Append(string.Format("\"{0}\":\"{1}\",", "id", drv["itemvalue"]));
parentsb.Append(string.Format("\"{0}\":\"{1}\",", "text", drv["itemtext"]));// "state":"closed",
parentsb.Append(string.Format("\"{0}\":\"{1}\"", "state", "closed")); //父级默认节点关闭状态
string codevalue = drv["itemvalue"].ToString();
string childSql = "select itemtext,itemvalue from code_items where codeid = (select codeid from code_main where codename ='荣誉等级') and itemvalue like '" + codevalue + "__'";
DataView childdv = Epoint.EduFront.Bizlogic.DB_Common.ExecuteToDataView(childSql);
StringBuilder childsb = new StringBuilder();
if (childdv.Count > )
{
childsb.Append(",\"children\":[");
foreach (DataRowView childdrv in childdv)
{
childsb.Append("{");
childsb.Append(string.Format("\"{0}\":\"{1}\",", "id", childdrv["itemvalue"]));
childsb.Append(string.Format("\"{0}\":\"{1}\"", "text", childdrv["itemtext"]));
childsb.Append("},");
}
parentsb.Append(childsb.ToString().TrimEnd(',') + "]");
}
parentsb.Append("},");
} sb.Append(parentsb.ToString().TrimEnd(',') + "]");
return this.GetResult(sb.ToString(), "success"); } /// <summary>
/// 获取荣誉代码项,返回Json串/// </summary>
/// <returns></returns>
public string GetHonorTitle(string codemainname)
{
string Sql = "select ItemValue,itemText from code_items where codeid =(select codeid from Code_Main where codename='" + codemainname + "') order by ItemValue asc";
DataView HTdv = Epoint.EduFront.Bizlogic.DB_Common.ExecuteToDataView(Sql);
StringBuilder sb = new StringBuilder();
sb.Append("[");
foreach (DataRowView dr in HTdv)
{
StringBuilder sb_SinglePost = new StringBuilder();
sb_SinglePost.Append("{"); sb_SinglePost.Append(string.Format("\"{0}\":\"{1}\",", "ItemValue", dr["ItemValue"].ToString()));
sb_SinglePost.Append(string.Format("\"{0}\":\"{1}\",", "ItemText", dr["ItemText"].ToString()));
sb.Append(sb_SinglePost.ToString().TrimEnd(',') + "},");
}
string result = sb.ToString().TrimEnd(',') + "]";
return this.GetResult(result, "success");
} #region 公共方法
private string GetResult(string data, string message)
{
if (data != "")
{
return "{\"data\":" + data + ",\"status\":\"" + message + "\"}";
}
else
{
return "{\"status\":\"" + message + "\"}";
}
} #endregion public bool IsReusable
{
get
{
return false;
}
}
}
ajax+json+ashx实现一个页面多个tab的分页的更多相关文章
- Jquery Ajax Json ashx 实现前后台数据传输
经过一个多星期的研究,各种查找资料终于自己实现了Jquery Ajax Json ashx 的前后台数据交流功能 首先一点,Ajax只能对应一个ashx文件,多余两个,如果打开异步传输的async: ...
- JavaScript解决一个带验证的Form两个Submit事件(一个页面保持不动【AJAX实现】,一个页面提交并跳转)的场景
<form class="form-horizontal" action="/biz/patent/edit" method="post&quo ...
- 本文使用springMVC和ajax,实现将JSON对象返回到页面
一.引言 本文使用springMVC和ajax做的一个小小的demo,实现将JSON对象返回到页面,没有什么技术含量,纯粹是因为最近项目中引入了springMVC框架. 二.入门例子 ①. 建立工程, ...
- {Django基础七之Ajax} 一 Ajax简介 二 Ajax使用 三 Ajax请求设置csrf_token 四 关于json 五 补充一个SweetAlert插件(了解)
Django基础七之Ajax 本节目录 一 Ajax简介 二 Ajax使用 三 Ajax请求设置csrf_token 四 关于json 五 补充一个SweetAlert插件(了解) 一 Ajax简介 ...
- 基于MVC4+EF5.0+Ajax+Json+CSS3的简单注册页面(get&post)
使用mvc4可以很快速的创建页面,但封装的过多,难免会有些性能上的问题.所以基于此,通过使用简单的手写html,加ajax,json来创建一个注册页面,会比较干净,简洁. 本项目的环境是MVC4+EF ...
- ASP.NET MVC WebApi 返回数据类型序列化控制(json,xml) 用javascript在客户端删除某一个cookie键值对 input点击链接另一个页面,各种操作。 C# 往线程里传参数的方法总结 TCP/IP 协议 用C#+Selenium+ChromeDriver 生成我的咕咚跑步路线地图 (转)值得学习百度开源70+项目
ASP.NET MVC WebApi 返回数据类型序列化控制(json,xml) 我们都知道在使用WebApi的时候Controller会自动将Action的返回值自动进行各种序列化处理(序列化为 ...
- {Django基础七之Ajax} 一 Ajax简介 二 Ajax使用 三 Ajax请求设置csrf_token 四 关于json 五 补充一个SweetAlert插件(了解)
{Django基础七之Ajax} 一 Ajax简介 二 Ajax使用 三 Ajax请求设置csrf_token 四 关于json 五 补充一个SweetAlert插件(了解) Django基础七之 ...
- Div里面载入另一个页面的实现(取代框架)(AJax)(转)
随着框架越来越不火了,HTML5就不对框架支持了,iframe也只有url了,Div就担当了此大任 DIV+CSS在页面部局确实也很让人满意,使用也更方便 今天突然遇到一个问题,那就是需要导入另一个页 ...
- 使用Ajax.ActionLink时,点击对应的按钮会重新加载一个页面,而不是在当前页面的指定模块加载
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
随机推荐
- 敏感词过滤的算法原理之DFA算法
参考文档 http://blog.csdn.net/chenssy/article/details/26961957 敏感词.文字过滤是一个网站必不可少的功能,如何设计一个好的.高效的过滤算法是非常有 ...
- hive连接mysql遇到的问题
启动hive之前应该先启动metastore,也是在bin目录下:./hive --service metastore &然后再启动hive: ./hive 今天连接hive时总是报错:Una ...
- 使用python 模仿mybinlog 命令 二进制分析mysql binlog
出处:黑洞中的奇点 的博客 http://www.cnblogs.com/kelvin19840813/ 您的支持是对博主最大的鼓励,感谢您的认真阅读.本文版权归作者所有,欢迎转载,但请保留该声明. ...
- 39.oracle高级篇
标题说是高级篇,其实也就是相对于基础篇来说的,也不是很深奥,自己平时工作中也都会用到,这里回忆的并不是特别冷门的知识,不要掉以轻心,以为“高级”就觉得工作中不会用到了. 一.select into 和 ...
- C# ListView用法详解 很完整
一.ListView类 1.常用的基本属性: (1)FullRowSelect:设置是否行选择模式.(默认为false) 提示:只有在Details视图该属性才有意义. (2) GridLines:设 ...
- 调用ajax的返回值,需要再ajax之外的函数体里return,以及同步异步问题
<html> <head> <meta charset="utf-8"/> <script src="js/jquery-1.1 ...
- Java NIO学习与记录(二):FileChannel与Buffer用法与说明
FileChannel与Buffer用法与说明 上一篇简单介绍了NIO,这一篇将介绍FileChannel结合Buffer的用法,主要介绍Buffer FileChannel的简单使用&Buf ...
- golang (4) golang 操作mongdb
1. 数据按照时间聚合操作 1.1 正常的数据结构 { "_id" : ObjectId("5cac8d7b1202708adf5d4b64"), " ...
- notepad++中配置python运行命令
1.安装notepad++ 2.打开notepad++ 3.键盘上按下“F5”,在弹出的命令菜单中输入“cmd /k C:\Python30\python.exe "$(FULL_CURRE ...
- 【实战】某项目SQL注入引发的思考
数据包: 测试参数:username,测试payload: ' ' or '1'='1 ' or '1'='2 响应结果都未发生任何变化,借助sqlmap测试,结果一样: 尝试在or前面进行简单的fu ...