1

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.

thatguy
  • 23
  • 1
  • 9
  • Possible duplicate of [Bootstrap 3 - How to load content in modal body via AJAX?](http://stackoverflow.com/questions/19663555/bootstrap-3-how-to-load-content-in-modal-body-via-ajax) – Fabio Antunes Feb 19 '16 at 14:57

0 Answers0