It does not seem to stop you from skipping to the top of the page.
I tried everything offered here preventing page transitions
What else could be done to stop the transitions to the onclick page?
Thanks.
Here's a snippet of HTML and JS
HTML: <a href="javascript: return null;" onclick='javascript:getPosts("page=1&display=all"); return false;'>Everyone</a> JS: function getPosts(qry) { var thePage = 'posts.php?' + qry; myReq.open("GET", thePage, true); myReq.onreadystatechange = theHTTPResponse; myReq.send(null); } function theHTTPResponse() { if (myReq.readyState == 4) { if(myReq.status == 200){ var response = myReq.responseText; document.getElementById('posts').innerHTML = response; } } else { document.getElementById('posts').innerHTML = '<img src="images/ajax-loader.gif" />'; } }
javascript ajax onclick
Bailey
source share