Title: [Plugin: Ajaxize] Infinite loop
Last modified: August 20, 2016

---

# [Plugin: Ajaxize] Infinite loop

 *  Resolved [jimaek](https://wordpress.org/support/users/jimaek/)
 * (@jimaek)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-ajaxize-infinite-loop/)
 * For some reason when i add the div what it does is to output the website inside
   it in a loop.
 * Example:
    function test_ajax(){ echo “Testing ajax”; }
 * I created the div and putted it in sidebar, after the page is loaded and ajax
   kicks in, in the div appears the web site itself, and in that website in the 
   sidebar another one… you get the idea.
    But in the preview in dashboard everything
   works ok.
 * No idea why it happens to me
 * [http://wordpress.org/extend/plugins/ajaxize/](http://wordpress.org/extend/plugins/ajaxize/)

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

 *  Thread Starter [jimaek](https://wordpress.org/support/users/jimaek/)
 * (@jimaek)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-ajaxize-infinite-loop/#post-2594207)
 * Never mind, i fixed it 🙂
 * The working version [http://pastebin.com/5rTYCag7](http://pastebin.com/5rTYCag7)
 *  Plugin Author [yoav.aner](https://wordpress.org/support/users/yoavaner/)
 * (@yoavaner)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-ajaxize-infinite-loop/#post-2594308)
 * Hey jimaek,
 * Sorry I didn’t check the forums for a while. Had a quick look at your change,
   and not sure it’s ideal really. You should really load ajaxize from the _same
   page_ that your content is loading from. This would allow your ajaxized function
   to have the same context as the page you’re on. Some functions of course don’t
   need this, but some certainly do.
 * I’d be grateful if you can let me know how to reproduce this loop. I could then
   look at some generic way to avoid it. This could improve ajaxize for other users
   too. It’s usually down to something not dealing with the ajaxize call correctly,
   and mistaking it for a request for the actual page, but I wasn’t able to reproduce
   this so far.
 * Cheers
    Yoav
 *  Plugin Author [yoav.aner](https://wordpress.org/support/users/yoavaner/)
 * (@yoavaner)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-ajaxize-infinite-loop/#post-2594315)
 * I’m not sure whether this is the case for you, but I have come across a loop 
   when ajaxize is used together with nginx.
 * For some reason, nginx and wordpress support permalinks a little differently,
   which caused the ajaxize parameters to get dropped unless you were on the homepage
   itself.
 * The solution in this case was to make sure that your nginx is configured with
   this directive:
 * `try_files $uri $uri/ /index.php?q=$uri&$args`
 * [see here for a little more info](http://nginxlibrary.com/wordpress-permalinks/)
 *  Thread Starter [jimaek](https://wordpress.org/support/users/jimaek/)
 * (@jimaek)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-ajaxize-infinite-loop/#post-2594316)
 * Yes im using nginx as you guessed. I think your are correct.
    But i will try 
   your fix later as i dont want to play with the production right now.
 * Thank you 🙂
 *  Plugin Author [yoav.aner](https://wordpress.org/support/users/yoavaner/)
 * (@yoavaner)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-ajaxize-infinite-loop/#post-2594317)
 * Thanks jimaek!
 * It’d be really useful if you could let me know when you get a chance to test 
   it. I am wondering if there’s a reliable way to detect the webserver (and potential
   mis-configuration) from within the plugin itself so to avoid infinite loops… 
   At the very least I will try to include some comments / update the faq to make
   sure people are aware of it.
 * Yoav
 *  Plugin Author [yoav.aner](https://wordpress.org/support/users/yoavaner/)
 * (@yoavaner)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/plugin-ajaxize-infinite-loop/#post-2594369)
 * Didn’t hear back from OP for some time, so marking as resolved

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

The topic ‘[Plugin: Ajaxize] Infinite loop’ is closed to new replies.

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

 * 6 replies
 * 2 participants
 * Last reply from: [yoav.aner](https://wordpress.org/support/users/yoavaner/)
 * Last activity: [13 years, 5 months ago](https://wordpress.org/support/topic/plugin-ajaxize-infinite-loop/#post-2594369)
 * Status: resolved