AbdullahGhanem / ajax-blade

Easy AJAX with blade
10 stars 3 forks source link

Unclear readme #1

Open Pandahisham opened 8 years ago

Pandahisham commented 8 years ago

It's difficult to understand , what it is trying to ajax ? is it fetching values from DB or fetching views/ partials . Sorry but i am not a native English speaker

AbdullahGhanem commented 8 years ago

it's Infinite Scroll . it's using laravel’s pagination functionality.

First thing that you need to do is return the data that you want to infinitely scroll from the controller:

public function getNewsPage(){

    $news = News::all()->paginate(10);

    return View::make('news', compact('news));
}

And then from your view file (news.blade.php) just loop through the items that you wish to output:

<div id="abs">
    <ul id="items">
    @foreach($news as $new)
        <li class="item">
            <a href="" target="_blank">{{ $new->title }}</a>
        </li>
    @endforeach
    </ul>
     @ajaxpagination($news)
</div>

you can visit www.respostat.com to show how work.

Pandahisham commented 8 years ago

thanks for clearing it :+1: , btw your demo page css needs some fixing i guess , while ajaxing the the views it adda a vertical scrollbar temporarily . also i think the plugin should be decoupled from jquery.

AbdullahGhanem commented 8 years ago

i cant fix it if you know how can fix it please sent me

Photoshopper commented 7 years ago

Is there a way to put a script that initializes jscroll to the bottom of the page, before ? I have all of my scripts at the bottom of the page and, I get error "Uncaught ReferenceError: $ is not defined",