[resolved] Infinite loop (7 posts)

  1. jimaek
    Posted 4 years ago #

    For some reason when i add the div what it does is to output the website inside it in a loop.

    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


  2. jimaek
    Posted 4 years ago #

    Never mind, i fixed it :)

    The working version http://pastebin.com/5rTYCag7

  3. yoav.aner
    Plugin Author

    Posted 4 years ago #

    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.


  4. yoav.aner
    Plugin Author

    Posted 4 years ago #

    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

  5. jimaek
    Posted 4 years ago #

    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 :)

  6. yoav.aner
    Plugin Author

    Posted 4 years ago #

    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.


  7. yoav.aner
    Plugin Author

    Posted 3 years ago #

    Didn't hear back from OP for some time, so marking as resolved

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Ajaxize
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic