AJAX不提交?

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.

Try to store first variables from post then use in query. So

$id =  $_POST["id"];

Same for others. Also you might find useful to send data at least as url encoded.

And then put in query.

You can use variables to reserve posted values first, then use them in update statement like this

<?php
if (isset($_POST['id']) && isset($_POST['just'])) {
    $id_val = $_POST['id'];
    $just_val = $_POST['just'];
    $update = mysqli_query($db, "UPDATE table SET just1 = '1', just2 = '$just_val' WHERE id = 'id_val'") or die(mysqli_error());
    if ($update) {
        echo "Success!";
    }
    else {
        echo "Error :(";
    }
}
?>