javascript - Delay between dynamic posts -
i have js code meant display each dynamically loaded posts when clicked on:
function showpost(id) { $.getjson('http://hopeofgloryinternational.com/?json=get_post&post_id=' + id + '&callback=?', function(data) { var output=''; output += '<h3>' + data.post.title + '</h3>'; output += data.post.content; $('#mypost').html(output); }); //get json data stories } //showpost
when test page 'http://howtodeployit.com/devotion/' on mobile or windows browser, clicked on daily devotional messages , navigate between each posts, notice accessed post still shows few seconds before new post gets displayed.
how refresh page or dom clears out accessed page.
function start line $('#mypost').html("");
before going request clear display content.
also can add waiting message $('#mypost').html("please wait...");
before showing content next request.
function showpost(id) { $('#mypost').html(""); //add line //$('#mypost').html("please wait..."); //also can add show waiting message. $.getjson('http://hopeofgloryinternational.com/?json=get_post&post_id=' + id + '&callback=?', function(data) { var output=''; output += '<h3>' + data.post.title + '</h3>'; output += data.post.content; $('#mypost').html(output); }); //get json data stories }
Comments
Post a Comment