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

Untitled

By: a guest on Jul 29th, 2012  |  syntax: None  |  size: 1.18 KB  |  hits: 9  |  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. How to display this message within the correct row, not within all rows
  2. var counter = 0;
  3.  
  4. function stopImageUpload(success, imagefilename){
  5.  
  6.       var result = '';
  7.       counter++;
  8.  
  9.       if (success == 1){
  10.          result = '<span class="imagemsg'+counter+'">The file was uploaded successfully!</span><br/><br/>';      
  11.          $('.listImage').eq(window.lastUploadImageIndex).append('<div>' + htmlEncode(imagefilename) + '<button type="button" class="deletefileimage" image_file_name="' + imagefilename + '">Remove</button><br/><hr/></div>');
  12.       }
  13.       else {
  14.          result = '<span class="imageemsg">There was an error during file upload!</span><br/><br/>';
  15.       }
  16.  
  17.  
  18.       $(".deletefileimage").on("click", function(event) {
  19.  
  20.          var image_file_name = $(this).attr('image_file_name');
  21.  
  22.     jQuery.ajax("deleteimage.php?imagefilename=" + image_file_name)
  23.       .done(function(data) {
  24.         $(".imagemsg" + counter).html(data);
  25.        });
  26.  
  27.        $(this).parent().remove();
  28.  
  29.     });
  30.  
  31.       return true;  
  32. }
  33.        
  34. <script language="javascript" type="text/javascript">window.top.stopImageUpload(<?php echo $result ? 'true' : 'false'; ?>, '<?php echo $_FILES['fileImage']['name'] ?>');</script>