title: Request fails with jquery-ajax but succeeded with curl
body: <p>I'm using jQuery to initiate an ajax request.
  When calling the request with jQuery I get an "Unexpected end of input" error and no response from the PHP file, but if I copy the request from the Chrome console as curl and run it with, say, linux command-line I get the correct response.</p>
  
  <p>This is the ajax function:</p>
  
  <pre><code>        var form = $('#edit form').first();
          $.ajax({
              url: 'upload.php?uuid=' + uuid,
              type: 'POST',
              data: form.serialize(),
              cache: false,
              success: function(data) {
                  console.log(data);
              },
              error: function( jqXHR, textStatus, errorThrown ){
                  console.log(jqXHR);
                  console.log(textStatus);
                  console.log(errorThrown);
              }
  
          });
  </code></pre>
  
  <p>I've checked to see if maybe it's a Chrome issue, but it seems to happen in other browsers as well.</p>
  
  <p>Thanks ahead</p>