标签:asp.net ajax mvc javascript jquery
<pre name="code" class="javascript">Ajax内容:
$(document).ready(function () { $(function () { $("#submit").click(function () { var name = $("#log").val(); var pwd = $("#pwd").val(); if (name.length == 0) { alert("请输入用户名!"); } else if (pwd.length == 0) { alert("请输入密码!"); } else { $.post("../../Content/Handler.aspx", { mName: name, mPwd: pwd }, function (data) { if (data == "right") { window.location.href = "ManagerIndex.aspx"; //指定登录成功后你要转向的页面 } else { alert(data); } }); } }); }); });
<pre name="code" class="csharp">protected void Page_Load(object sender, EventArgs e) { string name = Request.Form["mName"].ToString(); string pwd = Request.Form["mPwd"].ToString(); if (name == "hu") { Response.Write("right"); Response.End(); } else { Response.Write("用户名或密码错误!"); Response.End(); } }
ASP.NET MVC+JQuery母版页的Ajax提交问题
标签:asp.net ajax mvc javascript jquery
原文地址:http://blog.csdn.net/yiwuxun/article/details/39180625