## Simple AJAX code that refreshes every x seconds?

Question

I read that admin-ajax.php sends request every 15 seconds.

Knowing that, is there a simple code that I could use to take advantage of that?

What I mean by that, let’s say I have a text that is changing.

But to see the changes, I need to refresh the page every time.

Which I don’t want.

Instead I want to wrap that code around the AJAX:

<ajax code updates every 15 second>

My code goes here

</ajax code updates every 15 second>


to be updated in a real time.

That’s a very rough example, just to get the point.

Is there any simple way to do that?

I wish WordPress had a simple code that you put your code and it would update in real time.

Any help would be appreciated.

I want to refresh the code in the single.php template.

0
5 months 2021-07-14T11:41:53-05:00 0 Answers 0 views 0