在对图像进行排序后,我想将带有图像路径和标题的数组发送到 PHP 脚本。我可以在列表上执行“序列化”或“toArray”,但是如何从 img 标记中获取属性?
<ul class="gallery">
<li id="li-1">
<img src="tn/001.jpg" alt="first caption" />
</li>
<li mycaption="some caption" id="li-2">
<img src="tn/002.jpg" alt="second caption with éèçà international chars" />
</li>
</ul>
$(".gallery").sortable({
update : function() {
serial = $('.gallery').sortable('serialize');
alert(serial);
/* $.ajax({
url: "sort.php",
type: "post",
data: serial,
error: function() {alert("theres an error with AJAX");}
}); */
}
});