views:

156

answers:

1

hy, i have a php array with the name of some images! i list all the images use this:

$files = $_SESSION['files'];
$imgid = $_POST['id'];
if ($files){
        foreach($files as $image ):
            print '<li id="liupimages">'."\n";
                print '<a href="uploads/'.$image.'"><img id="'.$imgid.'" alt="'.$image.'" src="uploads/'.$image.'"></a>'."\n";
            print "</li>\n";
        endforeach;
    print <<<JS
<script>
$(".thumbs li a").click(function(){
    var largePath = $(this).attr("href");
    $('.thumbs li').removeClass('thumbac');
    $(this).parent().addClass('thumbac');
    $("#largeImg").hide()
                  .attr({ src: largePath })
                  .load(function() {
                       $(this).show();
                   });
    return false;
});

</script>
JS;
} 

i use jquery-ui to drag and drop images using this function:

$(function() {
    $("#upimagesQueue").sortable({ opacity: 0.6, cursor: 'move', update: function() {
    //??                                                         
    }                                 
    });
});

after i drag and drop one image i want to be able to update the php array to! how to do this?

+1  A: 

Use ajax:

$.get("re-arrange.php", { 'myArray[]': ['file1', 'file2']} );

http://api.jquery.com/jQuery.get/

Ben
but how i know the order of the images?
robertdd