Home Forums Front-end Issues Refresh custom gallery image without page reload using ajax


Refresh custom gallery image without page reload using ajax

  • The following script can be referenced live here:

    I’ve created a Portfolio of images consisting of a thumbnail slider and <div id=”main-image”> displaying a hero image and associated data ( title, excerpt, copy ) using an ACF repeater field with 4 subfields: healthcare_thumb, healthcare_hero, healthcare_title, healthcare_excerpt, and healthcare_copy. My HTML and PHP are as follows:

    * Code removed. Please wrap all code in backticks as instructed to avoid breaking HTML

    I’m not sure what I’m doing wrong but it’s probably in ““GET, myvar, true);
    as I’m not entirely sure how to get it to pass the dynamic imageID variable as is, I beleive, expecting a filename as it’s second parameter.

    Can anyone out there lend a hand? Many thanks in advance!

  • Hi @ddogdani,

    I believe you can use jQuery’s preventDefault() function to disable the redirection when you are clicking a link. This page should give you more idea about it:

    Also, could you please put your code in the “code” block so it won’t break thread page?

    Thanks 🙂

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

You must be logged in to reply to this topic.