• Hi Not sure if this has been addressed before, tried searching this forum with no luck.
    Im trying to see how i can refresh the section where the timer is without having to refresh the entire page(what im currently doing via js when counter reaches 0)

    any help would be greatly appreciated, im thinking something ajax related but not sure, i would take any solution that can refresh the section without refreshing the entire page.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Arno Welzel

    (@awelzel)

    Server side shortcodes or rules cannot be refreshed automatically. WordPress itself does also not support loading only parts of of a page or post via XHR (“Ajax”) – you can only get the whole page. So it wouldn’t make any difference if you reload using XHR or by just reloading the page itself.

    Thread Starter mikecrf121

    (@mikecrf121)

    ok thanks for your help. im pretty sure wp does support ajax though, and it would make a huge difference in my particular case, as site crashes at 1200 concurrent connections, so that number would probably at a minimum double if instead i was only reloading a div section instead of whole page. but thanks.. ill keep searching…

    awesome plugin though.

    Plugin Author Arno Welzel

    (@awelzel)

    No, WordPress does not have an XHR call to get just parts of a fully rendered post or page. This has to be handled as part of the template which has to provide the ability to support XHR calls to fetch just the formatted content of a post or page without header/footer etc.

    And furthermore the number of connections would be exactly the same, since XHR is also just a HTTP connection. Its exaclty the same – the only difference is, that XHR is initiated by a JavaScript on the page while a regular page reload is initiated by the browser itself. But the result is the same in both cases: the browser will open a connection to send a HTTP request to the server.

    Thread Starter mikecrf121

    (@mikecrf121)

    the communication method might be the same, but the size of whatever is being passed between the two endpoints your saying would make no difference on the maximum number of concurrent requests for the same page/(ideally section) the server could handle?? well now im confused, i thought it would make a difference if each load was half a MB vs say 2 or more.

    And to your wp point, i wasnt saying to use a built in wp api call or built in feature ootb, i was hoping to do it in a js api call via soap, rest, ajax, xhr, whatever. currently i have no issue reloading the whole page via js thats easy. Im trying to avoid that and also trying to avoid the use of iframes like a noob.

    Plugin Author Arno Welzel

    (@awelzel)

    If your web server has a problem to handle more than 1200 concurrent requests it does not matter if these requests are “normal” page loads or XHR requests. It also does not matter, how much data is transferred within a connection.

    How many visits to you have per day in average? If you have a problem with your server it’s either too slow or not configured properly to handle the load. But trying to load things using XHR instead of reloading a page wouldn’t solve anything here since the number of HTTP requests would not change – especially when the requests still ask WordPress to render content, the load on the server would not change significantly.

    And about WP and XHR: There is no API call in WordPress to get partially rendered content from it. So it is just impossible to do this – no matter if in XHR, SOAP or whatever – WordPress can’t provide partial content. Period.

    Edit: Yes, of course there are functions like get_post() etc. – but this will just return the content of a post in the database and not create the final HTML how it would be displayed using the current template.

    • This reply was modified 7 years, 1 month ago by Arno Welzel.
Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘refresh the section where timed content is’ is closed to new replies.