关于-AJAX-1
Posted 斜杠壹生
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于-AJAX-1相关的知识,希望对你有一定的参考价值。
1.遇到问题:
Chrome、firefox浏览器中video标签无法播放MP4视频问题
jianshu.com/p/a4aee97775c1
解决Chrome不能播放mp4视频的问题和HLS视频播放:---格式化工厂
2、测试:
strIsPostBack = null
isPostBack = false
zanCount = 3
http://www.bubuko.com/infodetail-130442.html
select top 1 1 from ... 是什么意思?
ELECT TOP 1 * FROM TABLE,这个是选TABLE的第一行记录。
SELECT TOP 1 * FROM的含义:
1、select为命令动词,含义为执行数据查询操作;
2、top 1子句含义为查询结果只显示首条记录;
3、*子句表示查询结果包括数据源中的所有字段;
4、from子句为指定数据源。
select top 1 ZanCount from Table_ZanCai
select top 1 ZanCount from Table_ZanCai
data = { ZanCount = 3, CaiCount = 3 }
CaiCount = 3
ZanCount = 3
3.
strIsPostBack = "true"
String.IsNullOrEmpty(strIsPostBack)=false
isPostBack = true
strIsPostBack = "true"=isPostBack = true
zan = "赞"
if(string.IsNullOrEmpty(zan))==false
Update Table_ZanCai set ZanCount = ZanCount+1
Update Table_ZanCai set ZanCount = ZanCount+8
context.Response.Redirect("ViewVideo.ashx");
4.
zan = null
string.IsNullOrEmpty(zan)=true
逻辑总结:
1.
请求.ahx(网页为空)
string strIsPostBack = context.Request["IsPostBack"];
IsPostBack=为空---strIsPostBack--为空
bool isPostBack;=false
if(String.IsNullOrEmpty(strIsPostBack))=true
{
isPostBack = false;
}
isPostBack = false;
if (isPostBack)
{
}
else
{
展示数据--传递数据库数据-到网页--渲染-统
}
2. 网页
string strIsPostBack = context.Request["IsPostBack"];
strIsPostBack = "true"
isPostBack = false
if(String.IsNullOrEmpty(strIsPostBack))==false
{
isPostBack = false;
}
else==返回
{
isPostBack = Convert.ToBoolean(strIsPostBack);
}
strIsPostBack = "true"
isPostBack = Convert.ToBoolean(strIsPostBack)= "true"
if (isPostBack)="true"
{
string zan = context.Request["Zan"];==true if(string.IsNullOrEmpty(zan)==false)==false { SqlHelper.ExecuteNonQuery("Update Table_ZanCai set CaiCount = CaiCount+1 "); context.Response.Redirect("ViewVideo.ashx"); } else==true==执行 { SqlHelper.ExecuteNonQuery("Update Table_ZanCai set ZanCount = ZanCount+1 "); context.Response.Redirect("ViewVideo.ashx") |
执行赞+1+...重新定位 ViewVideo.ashx" ----结束循环
}
}
else
{
3.执行1进行展示---踩得话相反步骤
回顾上一个:
string strIsPostBack = context.Request["IsPostBack"];
"IsPostBack" = "IsPostBack" strIsPostBack = nul |
<form action="ViewVideo.ashx" method="post"> <input type="hidden" name="IsPostBack" value="true" /> <p><input type="submit" name="Zan" value="赞" />$Model.ZanCount</p> <p><input type="submit" name="Cai" value="踩" />$Model.CaiCount</p> ------------------------------------------------------------------------- strIsPostBack = "true" |
bool isPostBack;//isPostBack = false
if(String.IsNullOrEmpty(strIsPostBack))//true
{
isPostBack = false;
}
else//false
{
isPostBack = Convert.ToBoolean(strIsPostBack);
}
strIsPostBack = null String.IsNullOrEmpty(strIsPostBack)//true isPostBack = false; |
strIsPostBack = "true" String.IsNullOrEmpty(strIsPostBack)//false isPostBack = false; isPostBack = Convert.ToBoolean(strIsPostBack); isPostBack = true |
if (isPostBack)//isPostBack = false;
{ isPostBack = true
string zan = context.Request["Zan"];
if(string.IsNullOrEmpty(zan))
{
SqlHelper.ExecuteNonQuery("Update Table_ZanCai set CaiCount = CaiCount+1 ");
context.Response.Redirect("ViewVideo.ashx");
}
else//false
{
SqlHelper.ExecuteNonQuery("Update Table_ZanCai set ZanCount = ZanCount+1 ");
context.Response.Redirect("ViewVideo.ashx");
}
zan = "赞" if(string.IsNullOrEmpty(zan)) //false SqlHelper.ExecuteNonQuery("Update Table_ZanCai set ZanCount = ZanCount+1 "); Update Table_ZanCai set ZanCount = ZanCount+1 15+1=16 试着用踩试一试 |
}
else= false;
{
int zanCount = (int)SqlHelper.ExecuteScalar("select top 1 ZanCount from Table_ZanCai");
int caiCount = (int)SqlHelper.ExecuteScalar("select top 1 CaiCount from Table_ZanCai");
var data = new { ZanCount = zanCount , CaiCount = caiCount };
string html = CommonHelper.RenderHtml("Admin/ViewVideo.html", data);
context.Response.Write(html);
}
zanCount = 15 caiCount = 5 data = { ZanCount = 15, CaiCount = 5 } CaiCount = 5 ZanCount = 15 $Model.ZanCount 15 $Model.CaiCount 5 <form action="ViewVideo.ashx" method="post"> <input type="hidden" name="IsPostBack" value="true" /> <p><input type="submit" name="Zan" value="赞" />$Model.ZanCount</p> <p><input type="submit" name="Cai" value="踩" />$Model.CaiCount</p |
以上是关于关于-AJAX-1的主要内容,如果未能解决你的问题,请参考以下文章