I’ll make it simple, i have this code :
$('#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 is as following :
var reInitFlip = function(data,id) {
};
All my items are in a list with an incremating ID, so i’m trying to send the function the
ID value of the item invoked this event, as there could be a few.
How can i send that data to the method? or alterntivly how can i know which element invoked the ajax call inside reInitFlip?
I guess you need something like this: