asp.net利用jquery的ajax方法来验证登陆的代码
许多程序员在做业务开发时往往会在服务器端做用户信息的验证,有没有考虑过用jquery的ajax方法来验证登陆呢?且效果比在服务器端写代码来验证好的多,页面无刷新即可实现实现登陆验证,代码也简单。
现在下面贴出来的是很简单的用jquery的ajax方法来验证登陆的代码,适合刚接触jquery的朋友学习。
前台页面代码:
<head>
<script src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
userlogin=function(){
$.ajax({
type:"get",
cache:false,
url:"ajaxpage.aspx",
dataType:"json",
data:"username="+$("#txt_username").val()+"&password="+$("#txt_pwd").val(),
success:function(data){
if(data.sta==1)
{
alert(data.info);
}
else
{
alert(data.info);
}
}
})
}
</script>
</head>
<body>
<div>
<table>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="用户名:"></asp:Labe
相关文档:
一。①:首先要有这个文件URLRewriter.dll,如果没有,赶快到网上下载一个,并将其放到下面的bin目录里面,并且将其引用添加到下面里面;
②:下面就是Web.Config文件的配置了,当然,配置过程相当简单:
1:先添加这个
<configSections>
<section name="RewriterConfig" type="URLRewriter.Config.Rew ......
DataGridView 控件DataGridView 控件提供用来显示数据的可自定义表。使用 DataGridView 类,可以自定义单元格、行、列和边框。
注意
DataGridView 控件提供 DataGrid 控件所不具备的许多基本和高级功能。有关更多信息,请参见 Windows 窗体 DataGridView 控件和
DataGrid 控件之间的区别
常用属性:
DefaultCellStyle、 ......
ASP.NET打开新页面而不关闭原来的页面
Respose.Write("<script language='javascript'>window.open('"+ url +"');</script>"); (打开简洁窗口):
Respose.Write("<script l ......
function saveObj(){
var userName = document.getElementById("userName").value;
checkUserName(userName);
}
//使用ajax实现页面无刷新功能;
var xmlHttpRequest;
function createXMLHttpRequest(){
if(windo ......
【相对路径】
Request.ApplicationPath
/src
Path.GetDirectoryName(HttpContext.Current.Request.RawUrl )
\\src\\Xiaoshe
Context.Request.Path
/src/Xiaoshe/Xiaoshe_New.aspx
Context.Request.CurrentExecutionFilePath
/src/Xiaoshe/Xiaoshe_New.aspx
Context.Request.FilePath
/src/Xiaoshe/Xiaoshe ......