drag and drop with jquery and php
Posted
by robertdd
on Stack Overflow
See other posts from Stack Overflow
or by robertdd
Published on 2010-04-19T02:58:59Z
Indexed on
2010/04/19
3:03 UTC
Read the original article
Hit count: 340
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?
© Stack Overflow or respective owner