I have some elements in my document which contains an Image IDs, and I want to replace those IDs with the Images:
$(".image_id_field").each(function() {
img_id = $(this).html();
$.post("ajax/get_image.php", { id: img_id }, function( response) {
// data = "<img src='path_to_image.png' />"
// How is it possible, to get the current $(this) in here to append the response
});
)
Two ideas I had:
1. Is it possible, to get the given id from the post parameters in the success function to identify the element?
2. Is it possible, to make the $post asynchronously and use the response after triggering the post request?