首页 > 其他 > 详细

ajax 简单学习

时间:2014-06-21 07:36:39      阅读:351      评论:0      收藏:0      [点我收藏+]
客户端代码
function
login(type) { $.ajax({ type: "post", url: "logindo.aspx", data: { user: $("#name").val(),//对应<input type="text" id="name"/>的值 pwd:pwd ////对应<input type="password" id="name"/>的值 }, success: function (data) { if (data == 0) { alert("用户名或密码错误"); } else { alert("登陆成功"); } }, error: function (a, b, c) { alert(a + b); } }); } </script>
protected void Page_Load(object sender, EventArgs e)
        {
       //vs提供的SqlDataSource绑定数据源控件
       //<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:online_work_managementConnectionString %>"
       //ProviderName="<%$ ConnectionStrings:online_work_managementConnectionString.ProviderName %>"
//SelectCommand="select_user" SelectCommandType="StoredProcedure">
            //<SelectParameters>
            //    <asp:Parameter Name="name" Type="String" />
            //    <asp:Parameter Name="pwd" Type="String" />
            //</SelectParameters>
           //</asp:SqlDataSource>

       //对应的存储过程为:
       //CREATE DEFINER=`root`@`localhost` PROCEDURE `select_user`(in user varchar(20), in pwd varchar(20), in user_type int(1))
       //begin
       // select * from user where username = name and password = pwd;
       //END SqlDataSource1.SelectParameters[
0].DefaultValue = Request.Form["name"]; SqlDataSource1.SelectParameters[1].DefaultValue = Request.Form["pwd"]; DataView dv = SqlDataSource1.Select(DataSourceSelectArguments.Empty) as DataView; Response.Write(dv.Table.Rows.Count); Response.End(); }

 

ajax 简单学习,布布扣,bubuko.com

ajax 简单学习

原文:http://www.cnblogs.com/jecyhw/p/3795369.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!