Title: AJAX/Javascript issue when the cache is enabled
Last modified: January 4, 2025

---

# AJAX/Javascript issue when the cache is enabled

 *  Resolved [Eric](https://wordpress.org/support/users/ericcodrongmailcom/)
 * (@ericcodrongmailcom)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/ajax-javascript-issue-when-the-cache-is-enabled/)
 * Hello,
 * On the homepage of the site [https://weddings-and-events.cdvillas.com](https://weddings-and-events.cdvillas.com),
   the “Locations” field of the search form is a “select” whose “option”s are generated
   on the fly after an Ajax request.
   When we enable the LiteSpeed ​​cache and clear
   it, everything works fine for a few hours, then a problem occurs that prevents
   the field from being built, which breaks the form.
 * If I clear the cache again, everything works for a few hours before the problem
   comes back.
 * I added “admin-ajax.php” in “Cache > [4] Exclude > Do Not Cache URIs”, but it
   didn’t change anything.
 * There are two things I don’t understand:
    - What causes this problem?
    - Why does the problem only occur after a few hours?
 * Do you know what is happening and how I can prevent this from happening?
 * Thank you,
 * Eric
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fajax-javascript-issue-when-the-cache-is-enabled%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/ajax-javascript-issue-when-the-cache-is-enabled/#post-18225769)
 * this sounds like a nonce issue , it works for few hours because nonce token has
   certain valid life time , and it stops working after it reaches expiration time
 * please provide the report number , you can get it in toolbox -> report -> click“
   send to LiteSpeed”
 * and meanwhile, please search keyword `es_get_locations` in the plugin that responsible
   for that selection field and share the result, you should see few lines mentioned
   keyword the `nonce`
 *  Thread Starter [Eric](https://wordpress.org/support/users/ericcodrongmailcom/)
 * (@ericcodrongmailcom)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/ajax-javascript-issue-when-the-cache-is-enabled/#post-18227817)
 * Report number: **KATHNEEM**
 * The plugin contains this line of code:
 * `'nonce_locations' => wp_create_nonce( 'es_get_locations' ),`
 * Is is what we are looking for?
 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/ajax-javascript-issue-when-the-cache-is-enabled/#post-18228551)
 * yes, now please try this , go to Cache -> ESI -> enable ESI, and add `es_get_locations`
   into ESI nonce list
 * save and purge all , see how it goes
 *  [mr_lars](https://wordpress.org/support/users/mr_lars/)
 * (@mr_lars)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/ajax-javascript-issue-when-the-cache-is-enabled/#post-18241180)
 * Hi, I have a similar problem in [https://milenanoventa.it](http://milenanoventa.it)
   and I think is better to continue this thred (tell me if is better to open a 
   new one)
   In the lower part of the page there’s a form by [https://wordpress.org/plugins/getwid/](https://wordpress.org/plugins/getwid/)-
   > [https://getwid.getmotopress.com/blocks/contact-form-block/](https://getwid.getmotopress.com/blocks/contact-form-block/)
   I think is the same problem presented in this thread.. I don’t know how to identify
   the corresponding object to “es_get_locations”…Could you help me?Report Number:**
   EZVDWULE** Thank youg
    -  This reply was modified 1 year, 4 months ago by [mr_lars](https://wordpress.org/support/users/mr_lars/).

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

The topic ‘AJAX/Javascript issue when the cache is enabled’ is closed to new replies.

 * ![](https://ps.w.org/litespeed-cache/assets/icon-256x256.png?rev=2554181)
 * [LiteSpeed Cache](https://wordpress.org/plugins/litespeed-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/litespeed-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/litespeed-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/litespeed-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/litespeed-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/litespeed-cache/reviews/)

## Tags

 * [ajax](https://wordpress.org/support/topic-tag/ajax/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 4 replies
 * 3 participants
 * Last reply from: [mr_lars](https://wordpress.org/support/users/mr_lars/)
 * Last activity: [1 year, 4 months ago](https://wordpress.org/support/topic/ajax-javascript-issue-when-the-cache-is-enabled/#post-18241180)
 * Status: resolved