我会简单点,我有这个代码:
$('#album_item' + currentCell).on('blur', '#caption_input' + currentCell, function(e) {
    e.stopPropagation();
    // we extract the num in the id to use related elements
    var numberPattern = /\d+/g;
    var id = $(this).attr("id");
    id = id.match(numberPattern);
    // save caption, when done reInitFlip
    $.ajax({
        type: "POST",
        url: "insert_caption",
        data: {
            thumbnail: file.thumbnail_url,
            caption: $('#caption_input' + currentCell).val()
        }
    }).done(reInitFlip(data, id));
});
reInitFlip 如下:
var reInitFlip = function(data,id) {
};
我所有的项目都在一个带有递增 ID 的列表中,所以我试图向函数发送调用此事件的项目的 ID 值,因为可能有一些。
我怎样才能将该数据发送到该方法?或者我怎么知道哪个元素调用了 reInitFlip 中的 ajax 调用?