How to response and image instead of responseText?
Hello, an http request is calling another page called test.php. And putting it all in an id called "countposts." I'm trying to pull an image from that page. So basically I'm just trying to call whats in the page, not any text at all. But I think there is something missing in the getelement by id, like a src. command or something. Anyone know how to take an image from a php page and stick it in an id? Whats missing in this get element so it puts an image in this id name? Please let me know, thank you very much.
I do because I'm going to have active content going all the time and need it without a page refresh. So how to take an image from test.php and put it in the id? I already have the request and body figured out, just need help with this javascript. Thanks.
The javascript I gave you will retrieve an image from the server. Then you just need to do the appropriate call to add that image into the page. No page refresh required as you can retrieve images from the server whenever you want just by referencing them from Javascript.
You can't retrieve images using Ajax because the images are not text or XML and are not actually in the web page but are separate files that are referenced from the page.
OK thank you very much. From looking at the code it looks like it is asking for a gif address. How do I keep the image reloading so that the image changes every so often?
img.src = 'imagetoload.gif';
set up an array of image filenames and then create a function that extracts one of the names from the array. Call the function from a setInterval call that specifies how often you want to download a new image.
Thanks very much I'll check it out. Is this affected by people who turn off their javascript? Someone please get back to me on how do you turn off javascript anyway? I know how to turn off popups.
Bookmarks