[RESOLVED] Get new picture?
This can be done with JavaScript or AJAX (It just has to work with all browsers).
My goal is to use a PHP script to return a picture's path, and then load the picture. The PHP part of the script is no biggy.
PHP Code:
echo getPicturePath();
Which will return 348344.jpg for example.
The bit that I can't workout how to do is to do this every second or so, and then actually load this picture onto the webpage.
Here's a thoery I've come up with, using JavaScript:
PHP Code:
<script>
var objPicure;
var latestPicture="";
init()
{
objPicure=document.getElementById("thePicture");
}
loadNewPicture(fileName)
{
??? //Loads the picture from the fileName URL and puts it into objPicure
}
updatePictureFile()
{
latestPicture=???; //Get the filename from the PHP script.
}
</script>
<img src="loading.jpg" id="thePicture" />
I'm familiar with JavaScript timers and would implement them too, just want to keep the theory simple.
Any tips :D?
Re: [RESOLVED] Get new picture?
AJAX is the pattern, JavaScript the language.