使用带有php和jquery的$ .post

Ok, Im trying to make a draggable CMS system, now Im stuck on the next problem.

When Im done dragging my 'div' I want to save my new left and top (x and y) variables in my MySQL database using PhP.

I get my left and top variables by the next line of codes:

$(function() {
    $( "#3" ).draggable({ 
        stop: function () {
            $.post("upload.php", {
                left: this.getBoundingClientRect().left,
                top: this.getBoundingClientRect().top
            })
        }, 
        containment: "#containment-wrapper", 
        scroll: false 
    });

my upload.php is:

<?
    mysql_query("UPDATE nvt SET left='". $_POST['left'] ."'")or die(mysql_error());
    mysql_query("UPDATE nvt SET top='". $_POST['top'] ."'")or die(mysql_error());
    header("Location: inlogged");
?>

When I'm done dragging my div there is just no reaction?

I think you are missing }); at the end. The code should be :

$(function() {
 $( "#3" ).draggable({ 
    stop: function ( event, ui ) {
        $.post("upload.php", {
            left: parseInt( ui.offset.left ),
            top: parseInt( ui.offset.top )
        })
    }, 
    containment: "#containment-wrapper", 
    scroll: false 
   });
}); //see the change