I am using jQuery to make the request to the view, i’ve been trying this. But i don’t think this is the correct way to do it
<script>
$(document).ready(function() {
$("#apiLink").click(function(event) {
event.preventDefault();
var modalContentElement = $("#modalContent");
// Make your AJAX request
$.ajax({
url: 'api/roadmap/1',
method: 'GET',
success: function(response) {
// Update the modal content with the fetched HTML
modalContentElement.html(response);
// Show the modal
$('#roadmapmodal').modal('show');
},
error: function(error) {
console.error('API error:', error);
}
});
});
});
</script>
I don’t think i should be using jquery to render the content in the modal ? I was thinking that i should still be able to use the context from the view?