alin19 Posted January 25, 2008 Share Posted January 25, 2008 i have made a grafic; but i must refresh the page to update that grafic, can i make it to generate new data without refreshing the page? Link to comment https://forums.phpfreaks.com/topic/87817-updating-grafic/ Share on other sites More sharing options...
rhodesa Posted January 25, 2008 Share Posted January 25, 2008 How do you call/generate the graphic? Link to comment https://forums.phpfreaks.com/topic/87817-updating-grafic/#findComment-449202 Share on other sites More sharing options...
Zhadus Posted January 25, 2008 Share Posted January 25, 2008 I would imagine you'd need to use javascript for that. Link to comment https://forums.phpfreaks.com/topic/87817-updating-grafic/#findComment-449205 Share on other sites More sharing options...
alin19 Posted January 25, 2008 Author Share Posted January 25, 2008 geting data from a database; time and prize variation; i have another program that updates the database Link to comment https://forums.phpfreaks.com/topic/87817-updating-grafic/#findComment-449207 Share on other sites More sharing options...
rhodesa Posted January 25, 2008 Share Posted January 25, 2008 If you have a PHP script generating a graphic, and you refer to it like so: <img id="random_pic" src="/images/random.php" /> You can update it with JavaScript like so: <script> function updateImage ( ) { var date = new Date; document.getElementById('random_pic').src = "/images/random.php?_="+date.getTime(); } </script> <img id="random_pic" src="/images/random.php" /> <input type="button" value="Update Image" onclick="updateImage();" /> Link to comment https://forums.phpfreaks.com/topic/87817-updating-grafic/#findComment-449211 Share on other sites More sharing options...
rhodesa Posted January 25, 2008 Share Posted January 25, 2008 the getTime() piece is to make sure it's a unique URL. this will keep the browser from caching the image Link to comment https://forums.phpfreaks.com/topic/87817-updating-grafic/#findComment-449212 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.