html - Ordered List and PHP -
good morning!
i have (i think) basic html - php question after hours of attempts can't seem right.
i have page, using jqueryui gridsort. on page, user can upload pictures pc web folder. pictures ahref'd inside of drag , drop ul.
for each image uploaded ( have ul declared avoid, , closed below)
$imgid++; echo '<li class="ui-state-default"><img id="'.$imgid.'"'.' src="user_files/'.$file_name.'" draggable="true" height="90" width="95"></li>'; this create drag , drop picture based on amount of files upload, , allows them visual reorganize them. in top left bottom right order. able return order images in. toyed $imgid++ assigning each image id, hoping help.
my question - how can return order of lists can process it. (i.e ill probalby put sql, or xml.)
thanks!
simple answer loop through images in ul assuming there nothing else in list li , image tags
var listofids = []; $('ul li').each(function(){ listofids.push($(this).find('img').prop('id)); }); $.ajax{[ url:'example.com', data: {'list':listofids}, type: 'post' ]}.done(function(msg){alert(msg);}); also should use database idnum id , not incrementer easy column update. make column called image_order , when update images in ajax script set order based on image id's
Comments
Post a Comment