Show a image to visitor and delete that image from the server (on same page load) - Javascript jQuery

Javascript examples for jQuery:Image

Description

Show a image to visitor and delete that image from the server (on same page load)

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script src="jquery.min.js"> 
      </script> 
   </head> 
   <body> 
      <script>
    function unlinkImage(src) {//from  www.ja va  2 s.co m
        $.ajax({
            type:"POST",
            url: "delete.php",
            data:{
                src:src
            }
        }).done(function() {
            console.log('done')
        });
    }

      </script> 
      <img src="http://www.java2s.com/style/download.png" onload="unlinkImage('someimage.png')">  
   </body>
</html>

Related Tutorials