I have a web page that displays several albums and the following html code for an album icon that should allow the user to change the access settings to the specific album ($row holds the response values from a db query that returns info on albums)
<a data-title="'.$row['title'].'" data-description="'.$row['description'].'" data-id="'.$row['photoCollectionId'].'" class="open-update_dialog2" data-toggle="modal" href="#update_dialog2">
<i class="ace-icon fa fa-eye"></i>
</a>
and if the user clicks on it, a modal shows up
<div class="modal fade" id="update_dialog2" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<ul id="check-list-box" class="list-group checked-list-box">
<?php
foreach (getFriends($email) as $row) {
$flag = checkAccessRights($row['email'],1)['value'];
echo '<li class="list-group-item" data-checked='.$flag.'>'.$row['firstName'].' '.$row['lastName'].'</li>';
}
?>
</ul>
</div>
</div>
</div>
.js
$(document).on("click", ".open-update_dialog2", function () {
albumName = $(this).data('title');
$(".modal-body #albumName").val(albumName);
albumDescription = $(this).data('description');
$(".modal-body #albumDescription").val(albumDescription);
albumId = $(this).data('id');
});
My problem is that each modal would need to fetch different data depending on the album the user clicked on and thus I want to replace the value of 1
in checkAccessRights($row['email'],1)
with the value of the variable albumName
.
Is there a way to get the value from jquery to php? Any tip would be greatly appreciated!