title: How can I upload a file using jquery's $.ajax function with json and php
body: <p>I am trying to upload a file using jQuery's <code>$.ajax</code> function but didn't get any output.
  Somebody please help me to solve this.
  I don't know if this script is correct.
  My script is:</p>
  
  <pre><code>$.ajax({
    url:'newsup.php',
    data: "",
    type: 'POST',
    contentType:'multipart/form-data',
    dataType: 'json',
    catche: 'false',
  
    success:function(data6)
    {
      $("#disp").removeClass().addClass((data6.error=== false)? 'success':'error').html(data6.msg).fadeIn('fast');
      //dele();
      if($("#disp").hasClass('success'))
      {
        alert("success");
        setTimeout("$('#disp').fadeOut('slow')",3000);            
      }
    },
  
    error:function(XMLHttpRequest,textStatus,errorThrown)
    {
      $("#disp").removeClass().addClass('error').html("There was an &lt;strong&gt;"+errorThrown+"&lt;/strong&gt; error due to  &lt;strong&gt;"+textStatus+" condition").fadeIn('fast');
    }              
  
  });
  </code></pre>
  
  <p>Also I need help getting data from file uploading field using jQuery.</p>