function initializePage() {
        //First, clear out the 'articles' div
        $("#articles").empty();
        //Next, we're going to grab all the articles the user hasn't flagged.
        $.get("/articles")
            .then(function(data) {
                //Cap it at 50 articles displaying at once.  You can only consume so much trump news.
                for (var i = 0; i < 51; i++) {
                    $("#articles").append(
                        `<div class="row">
                        <div class="col-sm-12"><div class="card">
                        <div class="card-header"><a class="article-url" target="_blank" href="${data[i].link}">${data[i].title}</a></div>
                        <div class="card-body">
                        <button type="button" class="btn-primary btn add_favorite" id="${data[i]._id}">Add to Favorites <ion-icon name="bookmark"></ion-icon></button>
                        <button type="button" class="btn btn-link comment" data-toggle="modal" data-target="#comment_modal" id="${data[i]._id}">Sound Off <ion-icon name="chatboxes"></ion-icon></button>
                        </div></div></div></div>`
                    )
                }
            });
    }
//Function will run on page load and after most routes to refresh the page
Function will run on page load and after most routes to refresh the page
Function will run on page load and after most routes to refresh the page
function initializePage() {
        $("#articles").empty();
        $.get("/articles")
            .then(function(data) {
                for (var i = 0; i < 51; i++) {
                    $("#articles").append(
                        `<div class="row">
                        <div class="col-sm-12"><div class="card">
                        <div class="card-header"><a class="article-url" target="_blank" href="${data[i].link}">${data[i].title}</a></div>
                        <div class="card-body">
                        <button type="button" class="btn-primary btn add_favorite" id="${data[i]._id}">Add to Favorites <ion-icon name="bookmark"></ion-icon></button>
                        <button type="button" class="btn btn-link comment" data-toggle="modal" data-target="#comment_modal" id="${data[i]._id}">Sound Off <ion-icon name="chatboxes"></ion-icon></button>
                        </div></div></div></div>`
                    )
                }
            });
    }
function initializePage ( ) { $ ( "#articles" ) . empty ( ) ; $ . get ( "/articles" ) . then ( function ( data ) { for ( var i = 0 ; i < 51 ; i ++ ) { $ ( "#articles" ) . append ( ` ${ data [ i ] . link } ${ data [ i ] . title } ${ data [ i ] . _id } ${ data [ i ] . _id } ` ) } } ) ; }
Function will run on page load and after most routes to refresh the page
Function will run on page load and after most routes to refresh the page
//First, clear out the 'articles' div //Next, we're going to grab all the articles the user hasn't flagged. //Cap it at 50 articles displaying at once.  You can only consume so much trump news.