Note that there are some explanatory texts on larger screens.

plurals
  1. POInitial Page blank until Page refresh
    text
    copied!<p>Basically when I hit the first page and click on the button, it should display the first 2 dynamic posts. Unfortunately no post is displayed until I hit the refresh button on my browser before the first 2 posts appears.</p> <p>I have spent hours trying to figure out what I am missing in this code:</p> <pre><code>$(document).ready( function () { var data = $.getJSON("http://howtodeployit.com/category/daily-devotion/feed/?json=recentstories", function(data) { var $postsList = $('#postlist'), $loadMore = $postsList.parent().find('.load-more'), currentPage = 0, postsPerPage = 2; var showMorePosts = function () { var offset = currentPage * postsPerPage, posts = data.posts.slice(offset, offset + postsPerPage); $.each(posts, function ( i, val ) { $('&lt;li/&gt;').append([$("&lt;h3&gt;", {html: val.title}),$("&lt;p&gt;", {html: val.excerpt})]).wrapInner('&lt;a href="#devotionpost" onclick="showPost(' + val.id + ')"&gt;&lt;/a&gt;').appendTo($postsList); }); if( posts.length !== postsPerPage ) { $loadMore.hide(); } currentPage++; $postsList.listview('refresh'); }; $postsList.listview(); showMorePosts(); $loadMore.on('click', showMorePosts); }); }); </code></pre> <p>HTML:</p> <pre><code>&lt;!-- Page: home --&gt; &lt;div id="home" data-role="page" data-theme="d" data-title="My Devotion"&gt; &lt;div data-role="listview"&gt; &lt;a href="#devotion" id="devotionclick" data-role="button"&gt;Daily Devotional Messages&lt;/a&gt; &lt;/div&gt;&lt;!-- links --&gt; &lt;/div&gt;&lt;!-- page --&gt; &lt;!-- Page: Daily Devotional Messages --&gt; &lt;div id="devotion" data-role="page" data-title="My Devotion"&gt; &lt;div data-role="header" data-theme="a" data-position="fixed"&gt; &lt;h2&gt;Daily Devotional Messages&lt;/h2&gt;&lt;/div&gt;&lt;!-- header --&gt; &lt;ul data-theme="d" id="postlist"&gt; &lt;/ul&gt;&lt;!-- content --&gt; &lt;div class="load-more"&gt;Load More Posts...&lt;/div&gt; &lt;/div&gt;&lt;!-- page --&gt; </code></pre> <p>Also seeing this error:</p> <pre><code>Uncaught TypeError: Cannot read property 'jQuery1101005234554712660611' of undefined </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload