Reload an image using ajax - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:ajax

Description

Reload an image using ajax

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-git.js"></script> 
  <script type="text/javascript">
    $(window).on('load', function() {
$('button').click(function() {
    var unique = $.now();/*from   w  w w. j ava2s. c om*/
    $('img').attr('src', 'http://www.java2s.com/style/demo/Safari.png' + unique);
});
    });

      </script> 
 </head> 
 <body> 
  <img src="http://www.java2s.com/style/demo/Opera.png"> 
  <button type="button">Refresh</button>  
 </body>
</html>

Related Tutorials