Jquery之简单应用
版本:jquery-1.7.1.js
添加的一些操作:
Ashx:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
//接收前台传值
string Method = context.Request.Params["M"];
switch (Method)
{
case "Ins":
InsertMessage(context); break;
}
}
//添加
public void InsertMessage(HttpContext context)
{
context.Response.Write("添加成功");
}
//是否重用此实例
public bool IsReusable
{
get
{
return false;
}
}
调用页面:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<script type="text/javascript">
function BtInsert() {
$.ajax({
type: "post",
url: "MyAshx/OpDB.ashx",
data: { M: 'Ins' },
success: function (msg) { alert(msg); }
});
}
</script>