Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How to preload ajax content inside functions.php

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #288396
    snippet248
    Participant

    Based in this code https://artisansweb.net/load-wordpress-post-ajax/ which basically is ajax in WordPress to load more posts, the problem is it takes too long to load the content inside functions.php it takes at leat 4 seconds. Is there any way I can preload certain code from functions.php asynchronously?

    #288428
    cuteshas
    Participant

    The reason of delay is possibly the data transfer using ajax. If you look at the code you will see the html format of the post is passed in the ajax call. More data is getting passed and it’s getting delayed. You can just pass an object of all post in ajax call and handle DOM manipulation through javascript.

    #288429
    snippet248
    Participant

    Thank you in!! in other words that reference code is loading the entire functions.php? Well initially it was “append” instead of “html” I modified it in order to replace the actual content.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.