Title: excluding some html from cache with javascript?
Last modified: August 31, 2016

---

# excluding some html from cache with javascript?

 *  [andrew55](https://wordpress.org/support/users/andrew55/)
 * (@andrew55)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/excluding-some-html-from-cache-with-javascript/)
 * To exclude dynamic content from cache, I’ve seen in the help files that JavaScript
   can be used to make an AJAX call.
 * What if I have a little dynamic html (divs, classes, etc) within my theme or 
   in a widget.
 * Does anyone have an example of how javascript can be used in this scenario to
   keep html from being cached?
 * I’ve been experimenting with document write and print, but getting nowhere.
 * [https://wordpress.org/plugins/zencache/](https://wordpress.org/plugins/zencache/)

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

 *  [KTS915](https://wordpress.org/support/users/kts915/)
 * (@kts915)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/excluding-some-html-from-cache-with-javascript/#post-7085848)
 * That’s a huge question! And it’s not really a Zen Cache issue; it’s more about
   javascript.
 * I’d suggest instead that you Google for help, particularly on Stack Exchange/
   Overflow.
 * And, if you post again, you’ll have to be much more specific so as to narrow 
   down what you want to do. In other words, you’ll need to set out the code and
   content you are currently using.
 *  Thread Starter [andrew55](https://wordpress.org/support/users/andrew55/)
 * (@andrew55)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/excluding-some-html-from-cache-with-javascript/#post-7085850)
 * KTS915 – thanks for the reply. I’ve been searching on Google and Stack Exchange
   for days about this, and don’t really seem to be getting anywhere. That’s why
   I thought of coming here.
 * I’ll keep looking, but I was hoping to find anyone here that’s had success with
   preventing caching with Javascript in ZenCache, or any other method.
 * I have some simple things for which I need to to exclude caching, like a link
   in a widget that needs to be different for logged in users/logged out users. 
   I also have a login form in a widget that should also be different for logged
   in/logged out users.
 * It would be great if anyone here even has a link to a resource that’s worked 
   for them.
 * Thanks for any suggestions.
 *  [KTS915](https://wordpress.org/support/users/kts915/)
 * (@kts915)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/excluding-some-html-from-cache-with-javascript/#post-7085853)
 * It’s difficult to be helpful without knowing specifically what you are trying
   to do.
 * If you put the following string into Google, though, you should get a whole host
   of useful resources: `jquery add content`

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

The topic ‘excluding some html from cache with javascript?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/zencache_3c4c6b.svg)
 * [ZenCache](https://wordpress.org/plugins/zencache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/zencache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/zencache/)
 * [Active Topics](https://wordpress.org/support/plugin/zencache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/zencache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/zencache/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [KTS915](https://wordpress.org/support/users/kts915/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/excluding-some-html-from-cache-with-javascript/#post-7085853)
 * Status: not resolved