I'm learning to use ajax. I'm facing problems while fixing the issues because there is no error notifications like PHP or MySQL. Till now, I have learn how to manipulate Database using CURD. Everything went well but MySQL itself still do nothing in this part. Please give me some idea, because I don't know what's the problem with this. I think I have not made any mistake.
$("#prodButton").on('click', function(){
if (jamStock< jamReq || fruitsStock< fruitsReq || sugarStock< sugarReq){
alert("ingredients is not enough");
} else {
$.ajax({
method: "POST",
url: "production.php",
data: {
jam: jamStock- jamReq,
fruits: fruitsStock- fruitsReq,
sugar: sugarStock - sugarReq,
},
success: function(data) {
alert("Data has been changed");
location.reload();
}
});
}
return false;
});
oh well about the production.php:
<?php
include 'connect.php';
if (isset($_POST['jam'])) {
$sql = "UPDATE ingre SET
jam =" . $_POST['jam'] . "
, fruits =" . $_POST['fruits'] . "
, sugar=" . $_POST['sugar'] . "
WHERE 1";
mysql_query($sql) or die(mysql_error());
} else {
die("browser unable to load");
}
?>