I want to have a Laravel HTML link which opens up a Bootstrap modal on the same page and fetches data from an ID in the link. Similar to what happens when you click a tweet on Twitter.
At the minute, I can only get it to open up on a new page.
blade.php:
{!! Html::linkAction('ContentController@getImages', 'Screenshots', array($row->ID), array('class' => 'trigger')) !!}
routes.php:
Route::get('screenshots/{id}', 'ContentController@getImages');
screenshots/{id}
is a different page. I want to open the Bootstrap modal on the same page, which is content/{year}/{category}
js:
$(document).ready(function() {
$('.trigger').on('click', function() {
$(window).scroll(function() {
clearTimeout($.data(this, 'scrollTimer'));
$.data(this, 'scrollTimer', setTimeout(function() {
$('#myModal').modal('show');
}, 250));
$(this).unbind('scroll');
});
});
});
I've tested this with a standard HTML link and it opens the Bootstrap modal fine.