473,385 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ajax image data fetch, javascript IMG data update?

Here is a toy problem describing what I want to do:

I have a web page with a single IMG element (say for a 128 x 128
"screen") which is initially blank (image=black pixels). I have AJAX
code that polls my server for updated image data. I would like to use
AJAX to fetch the image data, and then use javascript to update the IMG
data to show the new picture. This needs to work in IE and Firefox.

I've seen a few similar posts, but no concrete answers: is this
possible? If so, how?

Dec 8 '06 #1
2 5558
Marcus wrote:
Here is a toy problem describing what I want to do:

I have a web page with a single IMG element (say for a 128 x 128
"screen") which is initially blank (image=black pixels). I have AJAX
code that polls my server for updated image data. I would like to use
AJAX to fetch the image data, and then use javascript to update the IMG
data to show the new picture. This needs to work in IE and Firefox.

I've seen a few similar posts, but no concrete answers: is this
possible? If so, how?
It is not possible to provide an IMG element with binary data through
an XML HTTP request.

If it was possible to use a javascript pseudo-protocol URL as the SRC
of an image it may have been possible, but tortuously difficult (issues
with the text response being binary data (originally) interpreted as
UTF-8 into a javascript string of 16 bit code points and then needing
to be translated into a string that can be interpreted by the IMG's SRC
(on Mozilla/Gecko, where this is possible, the sting used is expected
to have a single byte of data in the each character)).

Richard.

Dec 8 '06 #2

Marcus wrote:
Here is a toy problem describing what I want to do:

I have a web page with a single IMG element (say for a 128 x 128
"screen") which is initially blank (image=black pixels). I have AJAX
code that polls my server for updated image data. I would like to use
AJAX to fetch the image data, and then use javascript to update the IMG
data to show the new picture. This needs to work in IE and Firefox.

I've seen a few similar posts, but no concrete answers: is this
possible? If so, how?
You can use Ajax to poll the server to determine when the image is
ready or what the new URL will be. When the new picture is available
just change the src attribute of the image tag and the browser will
automatically get and update the image.

Peter

Dec 8 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Randell D. | last post by:
Folks, I'm still learning javascript - I've invested in a couple of books and reading online as much as possible. I'm pretty sure what I am suggesting is possible though I'm trying to weigh up...
10
by: G Matthew J | last post by:
interesting "signal vs. noise" blog entry: http://37signals.com/svn/archives2/whats_wrong_with_ajax.php
5
by: darrel | last post by:
I've been playing with prototype.js and scriptaculous to create some nice drag-and-drop interaction on my applications GUI. That's working well. Now I want to take the next step and start passing...
1
by: danxavier | last post by:
I successfuly installed dd.php and sajax.php files. It runs fine, but I would like to link the $items to an image. I called the field in mysql with the link "pic". Any help would be AWESOME!!! I've...
2
by: shivendravikramsingh | last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if...
35
by: Kaante | last post by:
Hi, i want a frame on my website to display one pic if the user has new messages and another different pic if it dsnt. Before i used html to auto refresh page every 10 secs. that was annoying...
20
by: vjayis | last post by:
hi when i m trying to fetch data from one page to another page using ajax, i get an error message in IE., but it runs well in firefox., could anyone help me., here is my javascript code., ...
5
by: thatcollegeguy | last post by:
Below are my 3php and 2js files. I create a table using ajax/php and then want to change the values in the tables add(+ number for teamid) id's for each specific td in the table. I don't know...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.