title: How to preview an image before and after upload?
body: <p>I am going to preview an image or photo in a form, but it doesn't work and the HTML code looks like this as below:</p>
  
  <pre><code>&lt;form action="" method="post" enctype="multipart/form-data" name="personal_image" id="newHotnessForm"&gt;
      &lt;p&gt;&lt;label for="image"&gt;Upload Image:&lt;/label&gt;
      &lt;input type="file" id="imageUpload"/&gt;&lt;/p&gt;
      &lt;p&gt;&lt;button type="submit" class="button"&gt;Save&lt;/button&gt;&lt;/p&gt;
          &lt;div id="preview"&gt;
              &lt;img width="160px" height="120px" src="profile pic.jpg" id="thumb" /&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>and incorporated JS code/script below:</p>
  
  <pre><code>&lt;script type="text/jaavascript"&gt;
  $(document).ready(function(){
      var thumb=$('#thumb');
      new AjaxUpload('imageUpload',{
      action:$('newHotnessForm').attr('action'),
      name:'image',
      onSubmit:function(file,extension){
          $('#preview').addClass('loading');
      },
      onComplete:function(file,response){
          thumb.load(function(){
              $('#preview').removeClass('loading');
              thumb.unbind();
          });
          thumb.attr('src',response);
      }
      });
  });
  </code></pre>
  
  <p></p>
  
  <p>There are 2 main questions on my form:<br>
  1. Why doesn't the preview of the image or picture work?
  <br>2. How to paste the photo from the form when the save button is clicked, it will go/link to another PHP or PHP page that I created?</p>