How to update div on click without reloading the whole page?

Tell me, How to update div on click without reloading the whole page?
Googled all the solutions which is too abstruse, and pulling that *.php file to something else.

I have inserted the iframe in the div. as by clicking on a link to update only this div?

Example:
<a href="">Refresh</a>

<div id="exampleDiv">
<iframe id="exampleIframe" src="site.com"></iframe>
</div>
April 7th 20 at 15:52
4 answers
April 7th 20 at 15:54
Solution
const iframe = document.querySelector('#exampleIframe'),
 link = document.querySelector('a')
link.addEventListener('click', () => {
 iframe.src = iframe.src
 return false
})
April 7th 20 at 15:56
It is not entirely clear what it means to update a div. I suspect You need to reload page iframe. The first link in Google
April 7th 20 at 15:58
In what sense to update a<div>? What in this "upgrade"?
Or do you want to reload the contents of <iframe>?
If so, then you need to change the link in it. For example:
document.querySelector('a').addEventListener('click', () => {
 const url = new URL(the iframe.src)
 url.searchParams.set('__time' is a Date.now())
 iframe.src = url.toString()
})
April 7th 20 at 16:00
It is not entirely clear what it means to update a div. I suspect You need to reload page iframe. The first link in Google

Find more questions by tags JavaScript