There are several ways to do this. But please do not solve this with iframe.
If there should be only text in the modal text, put the empty modal in your main layout and fill it with variables.
- -, , ajax .
AJAX:
CSRF token DOM, . POST. Laravel POST- .
body. HTML, AJAX.
main.blade.php
<!DOCTYPE html>
<html lang="en">
<head>
...
<meta name="_token" content="{{ csrf_token() }}" />
</head>
<body>
...
<div class="modal fade" id="dynamic-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body"></div>
</div>
</div>
</div>
<script src="custom.js"></script>
</body>
</html>
HTML:
<button data-path="{{ route('post.show',$post->id) }}"
class="btn btn-info btn-xs load-ajax-modal"
role="button"
data-toggle="modal" data-target="#dynamic-modal">
<span class="glyphicon glyphicon-eye-open"></span> Show
</button>
AJAX
custom.js
$.ajaxSetup({
headers: {
'X-CSRF-Token': $('meta[name="_token"]').attr('content')
}
});
click , HTML- URL- ( data-path) .
$('.load-ajax-modal').click(function(){
$.ajax({
type : 'GET',
url : $(this).data('path'),
success: function(result) {
$('#dynamic-modal div.modal-body').html(result);
}
});
});
;)
2. EDIT
, , :