PDA

View Full Version : Content Type image/jpeg within Ajax XMLHttpRequest



x-mob
02-10-2006, 04:26 AM
Hi,

I understand easily how to load and displaying external html contents in a container using Ajax but i can't do it with a jpeg directly, like many others. I also know that Ajax is not needed for this simple task but in my case, i have a full html page with dynamic contents plus a couple of live jpeg still images that when i click on one of them, it need to refresh only one or all jpeg images at the same time without reloading the full page. Can't use iframe or things like that, Ajax is the way to do it correctly.

This demo here at Dynamic Drive loads a html page :
http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm
I know about external url, im using local url like 127.0.0.1 for the images.

Can we set the Content Type to image/jpeg? if yes, how ?

Thanks.
-------------------
http://blog.dsa.net/

Twey
02-10-2006, 07:24 AM
While you can get an image/jpeg filetype, there's not a lot HTML and Javascript will allow you to do with it after you've done so. Use image.src to specify a new source file for the image, and you'll achieve the effect desired.

x-mob
02-10-2006, 07:42 AM
While you can get an image/jpeg filetype, there's not a lot HTML and Javascript will allow you to do with it after you've done so. Use image.src to specify a new source file for the image, and you'll achieve the effect desired.

Well... you must take a look on what i working on before. It is an interface to control a PTZ camera, a small floating palette has the controls on it, you choose controls and then click on the image and the camera will move/zoom to the new location base on where you click, you know like old Web maps but this will change with the Ajax thing :-).

I don't think image.src work, it have to do a GET HTTP, i tried before without success...

http://206.162.130.3/e/drag.html?p=mountain_2&width=640

Thanks.

------------------
http://blog.dsa.net

Twey
02-10-2006, 04:14 PM
I don't think image.src work, it have to do a GET HTTP, i tried before without success...Changing the source of the image should cause the browser to perform an HTTP GET.
To be honest with you, I'd recommend using a Java applet for something like this. It is possible with DHTML, but I'm thinking it might be easier in Java.
11:04:01: there's a fly on your camera. :p

x-mob
02-10-2006, 07:23 PM
Changing the source of the image should cause the browser to perform an HTTP GET.
To be honest with you, I'd recommend using a Java applet for something like this. It is possible with DHTML, but I'm thinking it might be easier in Java.
11:04:01: there's a fly on your camera. :p

Oh! no Java, i found a way to do it with Ajax, i will update the sample later.
Thank you.

-------------------
http://blog.dsa.net/