Support

Account

Home Forums Front-end Issues Load data live without refreshing page

Solved

Load data live without refreshing page

  • Hi!

    I have the following situation:
    My posts consist of 4 advanced custom fields. I load all the data on the front-page of my wordpress. The page us functioning like a powerpoint-presentation so just one posts is shown and the others are hidden (via javascript). So when i load the page it gets all the data from advanced custom fields.

    Now my question. Is it possible to load all the data from advanced custom fields live when i change someting… without reloading the site? You dont need to tell me everyting i know its complex but just if there is any tutorial or something.

    Thx for your help and best regards.
    Pascal

  • I don’t think you’ll find a specific tutorial that will cover everything you need, but yes, this is possible.

    Here is a quick overview of what needs to be done.

    1. You need to create JavaScript that makes use that:
      1. Makes use of timeouts to check for changes on a regular bases. You can find plenty of information on timeouts by doing a google search.
      2. Is attached to the onclick of a link or button
    2. When the timeout fires you send an AJAX request, you’ll need to send the post ID so that your server side script knows what post to get the values for. The best information on AJAX in WP can be found here: https://codex.wordpress.org/AJAX_in_Plugins
    3. You’re server side script then gets the values from the ACF fields and sends them back. I would send them as a JSON object
    4. You’re AJAX Callback function parses the returned value and updates the content on the page.
  • Thank you so much for your help! That gives me an idea how to solve that problem.

  • Hi leuchterits.

    I am in the same situation. Honestly, I am a newbie. I would really appreciate it if you can share your solutions.

    Thanks.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Load data live without refreshing page’ is closed to new replies.