As you Know new images may be loaded after page load completed using event . for example i can fire a JQuery click event to run foo function that adds an image to a Div, and then that image will be loaded without needing to use Ajax . so what's going on?
whats the difference between using Ajax and just add that image to page using an event?
Asked
Active
Viewed 55 times
0

alex
- 7,551
- 13
- 48
- 80
-
2Are you asking what AJAX is? http://stackoverflow.com/questions/1510011/how-does-ajax-work – Davie Brown Jan 06 '16 at 11:02
-
Agreed with DavieBrown. i guess you misunderstood the ajax. there is no need of ajax to create any image in a webpage but javascript. – Jai Jan 06 '16 at 11:08
1 Answers
1
image will be loaded without needing to use Ajax . so what's going on?
This is your browser doing it's magic. The moment you add a url to an image source, your browser sends the request (to where ever the image is located ) and handles the response automatically.
whats the difference between using Ajax and just add that image to page using an event?
Well it's straight forward. Ajax is not meant to "get" images. You could eventually use AJAX to get an image url or a list of image url's and apply them to img element(s)... but the browser still automatically sends the request and handles the response.
Taken from the comments, you should read this to fully understand how AJAX works.

Community
- 1
- 1

kemicofa ghost
- 16,349
- 8
- 82
- 131
-
Nope. It also works for videos ( http://www.w3schools.com/tags/tag_video.asp ) and iframes ( http://www.w3schools.com/tags/tag_iframe.asp ) and script elements and link elements as well as others. – kemicofa ghost Jan 06 '16 at 11:36