Advanced AJAX Page Loader
[resolved] Retrieve Body Class from DATAA (7 posts)

  1. zumajoe
    Posted 3 years ago #

    Trying to grab the class names from the loaded content's Body Class (so that I can replace the body class on the current page with what was loaded), I've come up with the following but cannot seem to get this to work:

    classes =  jQuery(dataa).find('body').attr ("class").split(' ');
    for(var i=0; i<classes.length; i++){

    Anyone have a clue?


  2. jmeffre
    Posted 3 years ago #

    I'm looking for something like that to change the body class ... did you find the solution ? Thx

  3. MikeSV
    Posted 3 years ago #

    Looking for a solution to this too. Body classes are EXTREMELY important for my builds.

  4. Courtney Fantinato
    Posted 3 years ago #

    Any update on this? I need this as well.

    Many themes rely on the different body classes generated by WordPress, they should be able to be updated to the current page...

  5. Courtney Fantinato
    Posted 3 years ago #

    My work around is to put the WP generated body classes from body_class() on a div inside the #site-wrap div I am using in the "Content Element ID" setting.

    Note that anything (such as classes) on the element you're using for the "Content Element ID", and outside of it doesn't change.

    So if possible for some of you, it is easier to move body_class() from the body element inside what is actually being "refreshed" on the page so that it gets updated and can be used for CSS and PHP, rather than trying to change anything on the body tag.

  6. azharpratama
    Posted 2 years ago #

    You can't just use jQuery on "dataa" since it's not yet a DOM object of browser. The easiest way is to use workaround given by Courtney or parse the jqXHR string using .split function (hard way) which is time consuming :)

  7. Dean Williams
    Plugin Author

    Posted 2 years ago #

    You need to wrap your content area with a class or id that is constant, you should not ever be binding to the body tag as this will reload everything.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Advanced AJAX Page Loader
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic