I thought this would be easy enough but it's giving me problems. I tried searching other answers to solve this, but to no avail. I have a list of buttons where the id value is dynamic.
<a href="#" class="btn btn-default notesButton" data-id="<?php echo $id; ?>"
role="button">Notes</a>
 Then have JavaScript where I want to opent the modal window and get the id as a variable that I can echo in the window or use in a query.
$(document).ready(function(){
    $(".notesButton").click(function(){
        $("#notesModal").modal();
        var myOrderId = $(this).data('id');
    });
});
Finally, I try to echo myOrderId in the modal, or use it in a query. But, it doesn't show.
<div id="notesModal" class="modal fade" role="dialog">
    <div class="modal-dialog">
    <!-- Modal content-->
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">×</button>
            <h4 class="modal-title">Order Notes</h4>
        </div>
        <div class="modal-body">
          <?php echo $myOrderId; ?>              
        </div>
    </div>
    </div>
</div> <!-- end modal --> 
Once I'm able to echo this value, then it should be easy to use it in an sql query inside the window, but for now I can't get the value to echo in the modal window. Any suggestions please?
 
     
    