P
P
Pavel Efimov2019-03-04 18:02:45
AJAX
Pavel Efimov, 2019-03-04 18:02:45

How to update the chart without reloading the entire page?

5c7d4151de916467075769.jpegThere is an html page that includes a php file graph.phpwhere the chart is created. The html page is updated with . How can I update the chart without refreshing the entire page. Heard about Ajax, but it turned out to update only text data.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
origami1024, 2019-03-04
@neon3

document.querySelector("img").src = 'img.php?' + Math.random()

A
Alexander, 2019-03-04
@NeiroNx

setInterval(()=>{document.getElementById("myImg").src=document.getElementById("myImg").src.split("?")[0]+"?_="+(new Date()).getTime());},1000);

I would add a timestamp so that the browser understands that it is necessary to download the file again and not take it from the cache.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question