Jump to content


This topic is now archived and is closed to further replies.


AJAX Loading Module

Recommended Posts


Hello there, 

I should actually be in the paid support as my account name (same as my username) is a licensed user under the developer version. I have been trying to get some things to work, and while this product has alot of benefits to it, I am having one major shortfall that I am hoping to overcome. 


The issue is that I want to be able to invoke all links / navigation items on the page to invoke an ajax all request.

For the most part, this should be relatively simple. the process is wrap everything inside the <body> short of the footer includes, to be inside a wrapper, lets call it #ajaxContentLoader


I have been able to bypass your template by initiating my own custom wordpress plugin which fires off this : 


$(document).ready (function () {
     if ($("#ajaxContentLoader").length == 0) { 
     $("body").html ("<div id='ajaxContentLoader'>" + $("body").html () + "</div>"); 
in that ready function I can also call a bind to any anchor tags :
$("a").click (function (ev) {
     theURL = $(this).attr ("href");
     localisedURL = theURL.replace (dms_ajax_base_path,"");
     dms_ajax_loadPage (theURL,0);
which calls something like this : 
function dms_ajax_loadPage (theURL, push, getData) {
     nohttp = theURL.replace("http://","").replace("https://","");
     firstsla = nohttp.indexOf("/");
     pathpos = theURL.indexOf(nohttp);
     path = theURL.substring(pathpos + firstsla);
     if (typeof window.history.pushState == "function") {
     var stateObj = { foo: 1000 + Math.random()*1001 };
     history.pushState(stateObj, "ajax page loaded...", path);
     } else { document.location.href=path; //failsafe ? }
...and then proceeds to do the ajax call which parses out the elements required to recreate the body
which indeed does put the entirety of the body content inside the wrapper on the first load. great, step one complete.
I can also read and parse the html content so that it can establish things like the title. 
the problem I have is that once anything is fired via $(document).ready, jquery unbinds it from being triggered again, ie : $(document).trigger('ready'); does nothing. which obviously breaks your framework and any other on ready functions.
Is there anyway that I can capture all of the $(document).ready calls prior to the unbinding so that I may once again trigger them after refreshing the page content ?  I mean, I suppose on the first click to another link, i could first scan the document for any .ready strings, and then eval the content within on the next load, however, if the scripts are included externally, with a document.ready inside of it, I would think that it would just simply ignore it, unless of course, you scanned each script include...then again, I think I might be over complicating whats required.
I would love to offer you guys an AJAX plugin that you could include in your product, which could remain outside of the actual templates, and would be a choice of enable or disable.... and if you work with me to figure this out, I offer it up for you and others on your site. The obvious major benefit here is that you can create static elements that will persist (like audio players etc) from page to page, but the sky really is the limit. 

Share this post

Link to post
Share on other sites

I guess I should also mention that hash tag links "#" are ignored, as it seems that your editor relies on them, which is actually a good thing as far as this is concerned.

Share this post

Link to post
Share on other sites

So it seems Ive figured out a good chunk of this. 


test-prototype :


Theres a little youtube glitch obviously that pauses the video on the ajax request. but alot of this still works. 

What COULD be beneficial to my testing this however, is if you have a template which embodies many of your common functions. 


Please contact me at [email protected]
Also, could you please verify my account and promote this user to paid developer status so I can partake in other forums.

Share this post

Link to post
Share on other sites

Danny So I see you are the moderator from what I see here, any thoughts on this ?

Share this post

Link to post
Share on other sites
James B

Hi there, in order for your forum account to sync with your PageLines.com account the username and email needs to be the same on both accounts. We have modified your username for the forum to match your PageLines.com account so you will now have access to the Pro forums. Please log out of all PageLines systems and refresh your cache cookies then log back in and you should now have access.


You can find a list of hooks and filters for DMS at http://www.pagelines.com/api/dms-updates/hooks.php


And the full php reference files at http://phpxref.pagelines.com/


Hope this helps, have a great weekend.

Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post

Link to post
Share on other sites

ah that must be why, our operation manager signed us up, rather than me as our tech lead. Thanks for your assistance James. I will go over your list of hooks and filters as well. Cheers, and thank you for the help.

Share this post

Link to post
Share on other sites

  • Similar Content

    • webbdo
      By webbdo+
      I have search the forum on why there "admin-ajax.php" in the source of DMS / Pagelines. It seems that there is no reason for it to be there since it´s not fetching any "data" from somewhere else and do then get 403 error.
      Previous open (but not solved): http://forum.pagelines.com/topic/35786-the-old-not-saving-changes-dance/?page=2#comment-212187
      Second: http://forum.pagelines.com/topic/32997-saving-template-in-infinite-loop-and-custom-css-cant-be-added-nor-deleted/#comment-195728
      This appease on site: webbdo.se and are being executed to http://www.webbdo.se/wp-admin/admin-ajax.php
      What is this for and how can it be correct loaded or removed?
    • trizerticus
      By trizerticus
      I submitted a previous post and the overall standing was that I must be having a JS/AJAX problem because nothing would change when you attempted to save the settings. I am still having this problem, and would like help with a solution.
      website: http://crbs.ic2bm.com 
      already went into the JS Console and it stated there was a AJAX Error but disappeared before I could read the Error
      I am using chrome so any solutions on how to fix the ajax problem would be great.
    • LukeB
      By LukeB
      Hi I'm using ajax to load pages on my site but I am also using the Facebook like button short code http://support.pagelines.me/docs/miscellaneous/shortcodes/

      I need to reload the JS associated with this short code as the Facebook like button disappears when the page is loaded with JS. Could anyone assist me on the location of the file containing the JS? I have the reload code all figured out but I just need the file location.

      Any assistance would be much appreciated.

      Here's my homepage
      Link to a post where it will display normally on first load

      If you click through to a couple of posts you will notice the like button no longer shows up, it seems to display the first load of a page but if you keep clicking through posts it stops.

      The button should be displayed to the left of the following text beneath the post content 'Click like to get the latest music news, hottest tracks and more via Facebook.'