I have a list of records in a table with a button to show a Bootstrap modal dialog. It's currently showing the same modal dialog for each record in the table. Here's the HTML with some sample records:
<tr>
<td><button class="btn btn-default" data-toggle="modal" id="33926" data-target="#myModal">Review</button></td><td>Approved</td>
</tr>
<tr>
<td><button class="btn btn-default" data-toggle="modal" id="33951" data-target="#myModal">Review</button></td><td>Pending</td>
</tr>
and here's the html for the modal dialog:
<div class="modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">Review Job</h4>
</div>
<div class="modal-body">
<p>This will be dynamic content from database call</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
I'm now at the point where I need to make this dynamic, so that clicking the Review button passes the value for the id attribute for the selected row to a PHP page (getRecord.php) which does a database query and returns details for the selected row to be displayed inside the modal. I'm an intermediate PHP developer but have no experience with Javascript, AJAX and jQuery which I believe I need to use to make this happen.
I haven't been able to find a template or example that shows this in action with the required steps to make this happen. Bootstrap obviously uses jQuery so no issues with using that, just have no experience with this and calling a PHP page and passing data via the button click.