为什么我的登录表单总是向url传递数据?我设置了方法post,但仍然向url传递数据。我试图用另一种方式访问我的Web服务。它可以访问Web服务。错误。
意外的令牌
<form id="login">
<input type="text" name="username" placeholder="Your username">
<input type="password" name="password" placeholder="Your password">
<button id="button-login" class="col-90 button button-fill">SignIn</button>
<form>
$$('#button-login').on('click', function () {
console.log('click');
var x = new FormData($$("#login"));
console.log(x + " " + x[0] + " " + x[1]);
if (x[0] === '' || x[1] === '') {
console.log('belom diisi')
} else {
app.request.post('http://localhost/test_pmn_restful_api/user/create.php', x, function (data) {
app.dialog.alert(data);
});
}
});
header("Access-Control-Allow-Origin: *");
$password=$_POST['username'];
$username=$_POST['password'];
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
if($row['username']==$username && $row['password']==$password){
echo "bisa login";
}
else{
echo "gagal login";
}
}