| Author |
Will AJAX work with images?
|
chaitanya karthikk
Ranch Hand
Joined: Sep 15, 2009
Posts: 779
|
|
Hi everybody, I am Chaitanya, till now I tried AJAX only with XML and text. Can I try it with images. Can I get a image using AJAX?
If yes, can you please tell me where can I find it. I did a google search with key words "ajax and images" and "ajax with images". But I did not find any matter.
Thank you all in advance. Have a good day.
|
Love all, trust a few, do wrong to none.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56187
|
|
|
What would you do with the image data if you could get it?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
|
The IMG tag makes its own request to the server for it's src attribute separate from the initial HTTP request for the page itself. If you use JavaScript to change the src attribute of your IMG tag(s) it will change the image. No page refresh required.
|
 |
chaitanya karthikk
Ranch Hand
Joined: Sep 15, 2009
Posts: 779
|
|
Bear Bibeault wrote:What would you do with the image data if you could get it?
Hi Mr. Bear, there is a text field in my web page. When the admin enters some user id, his details must be displayed. This is the task I have to fulfill. Along with the details his image must be displayed.
I only know how to use AJAX with text, not with images. Can you please tell me how to do that and can you tell me where can I find online support. Please dont just say goolge. I tried in it already.
Thank you in advance. Have a good day.
|
 |
chaitanya karthikk
Ranch Hand
Joined: Sep 15, 2009
Posts: 779
|
|
Gregg Bolinger wrote:The IMG tag makes its own request to the server for it's src attribute separate from the initial HTTP request for the page itself. If you use JavaScript to change the src attribute of your IMG tag(s) it will change the image. No page refresh required.
Hi Mr. Gregg, thank you for this solution. I'll try this and reply back soon.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56187
|
|
chaitanya karthikk wrote:I only know how to use AJAX with text, not with images.
Ajax is not the right tool for this job. I ask again, what would you do with the mage data if you retireived it? How could you possiblt display it?
As Gregg pointed, out, you display images with the <img> tag, not Ajax.
|
 |
chaitanya karthikk
Ranch Hand
Joined: Sep 15, 2009
Posts: 779
|
|
Thank you Mr. Gregg & Mr. Bear, it worked.
|
 |
 |
|
|
subject: Will AJAX work with images?
|
|
|