• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Will AJAX work with images?

 
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What would you do with the image data if you could get it?
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Mr. Gregg & Mr. Bear, it worked.
 
reply
    Bookmark Topic Watch Topic
  • New Topic