I'm using the method already laid out in this thread:
Passing data to a bootstrap modal
It works spot on. I am able to pass data to the modal and display it in a field within a form. The question is: what's the easiest way to use that data in a ColdFusion query within the modal body?
Modal Button:
<a data-toggle="modal" data-id="495.00" title="View Dates" class="open-registerModal btn btn-primary" href="#registerModal">test</a>
Javascript
<script type="text/javascript">
$(document).on("click", ".open-registerModal", function () {
var myPrice = $(this).data('id');
$(".modal-body #price").val( myPrice );
});
</script>
Modal Body Query
<cfquery name="getdata" datasource="thedatabase">
SELECT *
FROM Table
WHERE cost = (PRICE FROM ABOVE)
</cfquery>
I would really like to use the same modal for all of the buttons on my page and just change out the data-id on each individual button. Any suggestions?