首页 新闻 赞助 找找看

node express 用户登录 如何post到本页面 处理完跳转页面 在线急等

0
悬赏园豆:5 [待解决问题]

如题,

form 的 action 为空 不是就是post到本页面了吗,要咋写呢 求教了
我的功能很简单,页面上一个用户名 一个密码 一个submit按钮
觉信的主页 觉信 | 初学一级 | 园豆:66
提问于:2017-06-05 17:05
< >
分享
所有回答(1)
0

$.ajax({

//类型
type: 'post',
url: '/api/user/login', //后台接受的地方
//提交的数据
data: {
username: $loginBox.find('[name="username"]').val(),
password: $loginBox.find('[name="password"]').val()

},
dataType: 'json',
success: function(result) {

$loginBox.find('.colWarning').html(result.message);
if (!result.code) {
window.location.reload();
}
}
});

 

提交后刷新----window.location.reload();
}

提交后跳转页面 --window.location.href(url);
}

 

老年游侠 | 园豆:364 (菜鸟二级) | 2017-06-06 23:08
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册