您现在的位置是:网站首页> 编程资料编程资料
jquery提交表单mvc3后台处理示例_实用技巧_
2023-05-24
220人已围观
简介 jquery提交表单mvc3后台处理示例_实用技巧_
JQuery提交表单
复制代码 代码如下:
$(document).ready(function () {
$("#btnLogin").click(function () {
$.ajax({
url: '/Home/Login',
data: '{ "account":"' + $("#account").val() + '", "psword": "' + $("#psword").val() + '" }',
type: "post",
contentType: "application/json;charset=utf-8",
dataType: "json"
,
success: function (data) {
if (data != "")
alert(data);
else
location.href = "/Home/Index"
}
});
});
});
mvc3后台处理:
复制代码 代码如下:
[HttpPost]
public ActionResult Login(string account, string psword)
{
JsonResult result;
if ("" == account && "" == psword)
result = this.Json("");
else
{
result=this.Json("用户或密码不正确");
}
return result;
}
您可能感兴趣的文章:
相关内容
- http调用webservice操作httprequest、httpresponse示例_实用技巧_
- Forms身份认证在IE11下无法保存Cookie的问题_实用技巧_
- http调用webservice操作httprequest、httpresponse示例_实用技巧_
- Forms身份认证在IE11下无法保存Cookie的问题_实用技巧_
- 由于扩展配置问题而无法提供您请求的页面错误解决方法_实用技巧_
- 三步将Asp.Net页面输出到EXCEL里_实用技巧_
- 利用ascii码传输xml转义字符示例_实用技巧_
- jQuery实现倒计时跳转的例子_实用技巧_
- asp.net使用ODP即oracle连接方式的的防注入登录验证程序_实用技巧_
- 高效的使用 Response.Redirect解决一些不必要的问题_实用技巧_