首页 > 代码库 > ASP.NET MVC 表单submit()
ASP.NET MVC 表单submit()
HTML代码
<form id="frmLogin"> <div class="form-group has-feedback"> <input type="text" class="form-control" placeholder="账户" id="user"> <span class="glyphicon glyphicon-envelope form-control-feedback"></span> </div> <div class="form-group has-feedback"> <input type="password" class="form-control" placeholder="密码" id="password"> <span class="glyphicon glyphicon-lock form-control-feedback"></span> </div> <div class="row"> <!-- /.col --> <div class="col-xs-12"> <button type="submit" class="btn btn-primary btn-block btn-flat">登录</button> </div> <!-- /.col --> </div> </form>
JS代码
$("#frmLogin").submit(function (e) { $.ajax({ type: ‘Post‘, dataType: ‘text‘, url: ‘/sysUser/verification‘, async: false, data: { user: $("#user").val(), password: $("#password").val() }, //登录成功:success,登录失败error success: function (result) { if (result == "success") { alert("用户名或密码正确!"); //location.href = "http://www.mamicode.com/main/i"; } else { alert("用户名或密码错误!"); } } }); });
ASP.NET MVC 表单submit()
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。