Home > Article > Backend Development > Drag and sort pictures, how to save the sorted order?
Now I want to save the current order of the pictures after dragging and sorting them. The problem is that when I drag the pictures now, when I click save, it is still in the previous order.
<code> //获取图片数组 var goods_img = new Array; $("._img").each(function(i){ goods_img[i] = $(this).attr('src'); });</code>
I change the position of the pictures, but the order of the pictures obtained does not change. Is there any way to drag the pictures so that the order of the pictures obtained also changes?
Now I want to save the current order of the pictures after dragging and sorting them. The problem is that when I drag the pictures now, when I click save, it is still in the previous order.
<code> //获取图片数组 var goods_img = new Array; $("._img").each(function(i){ goods_img[i] = $(this).attr('src'); });</code>
I change the position of the pictures, but the order of the pictures obtained does not change. Is there any way to drag the pictures so that the order of the pictures obtained also changes?
After dragging into the database, update the database and refresh the page