第一种:
aspx的html视图中:
function GETPASS(pass)
{
var surl="";
surl = "Deal.aspx?PASS=" + pass+"&action=GETPASS";
var sxmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
sxmlhttp.open("POST", surl, false);
sxmlhttp.send();
var soDiv = window.document.createElement("DIV");
soDiv.innerHTML = sxmlhttp.responseText;
if (!soDiv.children[0].type || soDiv.children[0].type != "errSource")
{
var strtrue=soDiv.children[0].innerText;
return strtrue;
}
}
在a.aspx.cs后台文件里:
private void GETPASS()
{
#region 变量定义
DataTable dtSource = new DataTable();
DatabaseOperation dboSel = new DatabaseOperation();
string sSqlSource="";
#endregion 变量定义 结束
dboSel.BeginTransaction();
try
{
sSqlSource=getsql();
dboSel.ExecuteUpdate(sSqlSource );
dboSel.Commit();
}
catch(Exception err)
{
dboSel.RollBack();
Response.Write("<DIV type='errSource'>保存失败!错误信息:" + err.Message.ToString() + "</DIV>");
}
#region 结束提示
Response.Write("<DIV type='hintInfo'>保存成功!</DIV>");
#endregion 结束提示 结束
}