Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 25th, 2012  |  syntax: None  |  size: 1.09 KB  |  hits: 25  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <!doctype html>
  2.  
  3. <head>
  4. </head>
  5.  
  6. <body>
  7.    
  8.     <table id="artist_table">
  9.        
  10. %for artist in artists:
  11.         <tr>
  12.             <td id="image"><img class="artistImg"></td>
  13.             <td id="name"><a href="artistPage?ArtistID=${artist['ArtistID']}" title="${artist['ArtistID']}">${artist['ArtistName']}</a></td>
  14.         </tr>
  15. %endfor
  16.  
  17.     </table>
  18.    
  19. </body>
  20. </html>
  21.  
  22. <script src="js/libs/jquery-1.7.2.min.js"></script>
  23. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  24. <script>
  25.  
  26. function getArtistArt() {
  27.     $("table#artist_table tr td#name").each(function(){
  28.         var id = $(this).children('a').attr('title');
  29.         var image = $(this).parent().find("td#image img");
  30.         getThumb(id, image);
  31.         });
  32.     }
  33.  
  34. function getThumb(artistid, image) {
  35.     $.ajax({
  36.         url: "getThumb?ArtistID=" + artistid,
  37.         success: function(data){
  38.             var artistImg = data;
  39.             $(image).attr("src",artistImg);
  40.         }
  41.         });
  42.     }
  43.    
  44. $(document).ready(function() {
  45.     getArtistArt();
  46. });
  47.  
  48. </script>