Related to my previous question: How to use javascript load function twice? (load in load)
I've got everything working (load in load). But now I want to use a foreach which sends data to the second load.
When I use this foreach the data (POST ID) remains the same.
Example code:
<script >
$(document).ready(function () {
// Forum categories
$("#main").on("click", "#message", function () {
$("#getmessage").load("forum/getmessage.php", {'id': $("#id").val()});
});
});
</script >
<?php foreach($stickies as $sticky): ?>
<form id="form_id" >
<a href="#" class="list-group-item small" id="message"
style="background-color:black; color:white;" >
<span class="glyphicon glyphicon-pushpin" aria-hidden="true" ></span >
| <?php echo $sticky['header']; ?>
</a >
<input type="hidden" id="id" name="id" value="<?php echo $sticky['id']; ?>" >
</form >
<?php endforeach; ?>
As you can see I'd like to push the value ID as POST data, so the loaded file can perform a query on this POST ID.
How can I send the correct ID for every foreach?