Hello so I'm new to ajax and jquery and I ran into a problem. I'm currently trying to check if a button was pressed and if the button was pressed I'd like to call a PHP file that has some code in it that checks some database stuff. My problem is that when I press the button nothing happens, so no console output, PHP file doesn't execute(I think nothing happens though) and I don't know how to fix it.
My javascript file:
$(".button").click(function() {
$.ajax({
method: "POST",
url: "./checkData.php",
data: { action: "call_this" }
}).done(function() {
console.log("success");
});
});
my html file:
<body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<div style="width:300px;height:500px;" class="centered">
<div class="form">
<form class="login-form" method="POST">
<input type="text" name="username" placeholder="Uporabniško ime" value="" />
<input type="password" name="password" placeholder="Geslo" value="" />
<button>prijava</button> <!-- TO PA JE GUMB -->
<p class="message">Nisi administrator? <br style="line-height:150%" /><a id="guest" href="#">Prijava kot gost</a></p>
</form>
</div>
<script src="java.js"></script>
</body>