• 企业400电话
  • 微网小程序
  • AI电话机器人
  • 电商代运营
  • 全 部 栏 目

    企业400电话 网络优化推广 AI电话机器人 呼叫中心 网站建设 商标✡知产 微网小程序 电商运营 彩铃•短信 增值拓展业务
    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;

            }

    您可能感兴趣的文章:
    • mvc中form表单提交的三种方式(推荐)
    • 详解ASP.NET MVC Form表单验证
    • 支持ASP.NET MVC、WebFroM的表单验证框架ValidationSuar使用介绍
    • Spring MVC中基于自定义Editor的表单数据处理技巧分享
    • Mvc提交表单的四种方法全程详解
    上一篇:http调用webservice操作httprequest、httpresponse示例
    下一篇:在C#中生成与PHP一样的MD5 Hash Code的方法
  • 相关文章
  • 

    © 2016-2020 巨人网络通讯 版权所有

    《增值电信业务经营许可证》 苏ICP备15040257号-8

    jquery提交表单mvc3后台处理示例 jquery,提交,表单,mvc3,后台,