Ajax数据传递格式
$.ajax({
url: '/login',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({"name": username, "pwd": password}),
success: function (data, status) {
if (status == 'success') {
if (data === '0') {
alert("用户不存在,请先注册");
} else {
alert("登陆成功");
// location.href='/'
this.props.onName(username);
browserHistory.push('/');
}
}
}.bind(this),
error: function (data, status) {
if (status == "error") {
// location.href='login'
}
}
});
努力没有早晚,耕耘就有收获

浙公网安备 33010602011771号