Home>

I couldn't find an answer on the Internet (using ajax). I saw an implementation like this:

<
div id= 'chat' onload= "refresh ()" >
...
<
/div >
function refresh () {
    setTimeout (window.location.reload (), 500);
}

Will it work? (I want to check before uploading to hosting)

"I couldn't find an answer on the Internet" ......... "I looked at such an implementation" ---so where did I look if I didn't find an answer on the Internet?

Алексей Шиманский2021-10-10 16:14:45

Yes, I have an error. Is this how the code will work or not?

Амирхан Айдархан2021-10-10 16:17:54

of course not. because you don't have to guess but look at the ajax documentation. what it is and how to work.

Алексей Шиманский2021-10-10 16:19:24

there are no ajaxes at all

Алексей Шиманский2021-10-10 16:20:46

It will work, but not as you expect (if the browser allows such a load event handler, then there will be a cyclic refresh of the entire page, similar to holding down the F5 key). AJAX and dynamic content are a little bit related, but different things, so you'll have to learn both. And for the future, if you're wondering: block elements have been phased out for a few years now (since the fifth revision of HTML was released). Block size model -in CSS it remained in the 4th edition of the style standard, but this is not the same thing.

yar852021-10-10 16:43:10