I have this code:
var just = $("#just").val();
var id = $("#id").val();
$.ajax({
type: "POST",
url: "cod_ajax/just.php",
data: "id="+id+"&just="+just,
cache: false,
success:function(e){
alert("Success");
}
});
And I have this in cod_ajax/just.php
require "../../db.php";
if (isset($_POST['id'])) {
$update = mysqli_query($db, "UPDATE table SET just1 = '1', just2 = '".$_POST['just']."' WHERE id = '".$_POST['id']."'") or die(mysqli_error());
if ($update) {
echo "Success!";
} else {
echo "Error :(";
}
}
The SQL code is all acording to database, the db require is okay too, but something seems to not work. I tried to erase one of the data provived by AJAX, like the id but it didn't work anyway nor the just2.
Also checked if both variables where empty or not unexistent but both have information in them.
MORE INFORMATION
I ran this on local server, no errors on console, alert(e) gave me success, all Jquery is included in page.