There are a couple of alert()
calls in the jQuery which are showing up, but the alert
inside the $.post
does not seems to respond. I already tested the PHP code and it works fine. I think it is my path
, but I already check them before.
<form id="login-form" method="post" class="form-inline" target="_top">
<input type="text" tabindex="2" id="username" placeholder="Username" name="email" class="inputtext">
<input type="password" tabindex="3" id="userpass" placeholder="Password" name="pass" class="inputtext">
<button tabindex="4" id="loginButton">Login</button>
</form>
$(document).ready(function(e) {
$('#loginButton').click(function(e) {
alert("start function");
$.post('../php/login.php', {
'username': $('#username').val(),
'userpass': $('#userpass').val()
}, function(data){
alert(data);
});
alert("end function");
});
});
<?php
require('config.php');
$queryStmt = 'SELECT user_first, user_last FROM users WHERE user_name=:sqlIdName AND user_password=:sqlPass';
$queryPrepare = $dba_connect->prepare($queryStmt);
$queryPrepare->execute(array(':sqlIdName'=>$_POST['username'],':sqlPass'=>md5($_POST['userpass'])));
$queryResult = $queryPrepare->fetch(PDO::FETCH_ASSOC);
$queryPrepare->closeCursor();
var_dump($queryResult);
if ($queryResult == false)
return false;
else
return true;
?>
My file structure is this: