How to get the response of AJAX from JQUERY : <p>I know this question has been asked many times but the guys who asked before me had a slightly different issue. I have a [simple page to upload photo][1]. This one is placed on my localhost. I can select file and upload image into upload folder. I can get response and using Firefox console - "Net" tab - I can see the response - which is printed as html code. I could get the DOM using JQuery $("#message").html() function. However what I wanted to try is this. Instead of printing tags or JSON structure data just send error code. echo 0; for success. Echo -1; for failure. The live code is place [here][2]. Now what I tried with php file ajax_php_file.php is this:</p>

<pre><code>&lt;?php
if(isset($_FILES["file"]["type"]))
  {
  $validextensions = array("jpeg", "jpg", "png");
  $temporary = explode(".", $_FILES["file"]["name"]);
  $file_extension = end($temporary);
  if ((($_FILES["file"]["type"] == "image/png") || 
       ($_FILES["file"]["type"] == "image/jpg") ||
       ($_FILES["file"]["type"] == "image/jpeg")
  ) AND 
  $_FILES["file"]["size"] &lt; 128000 AND // 125kb files can be uploaded.
  in_array($file_extension, $validextensions)) {
  if ($_FILES["file"]["error"] &gt; 0)
    echo '-1';
  else
  {
    echo '-2';
  if (file_exists("upload/" . $_FILES["file"]["name"])) {
    echo '-3';
  }
  else
  {
  $sourcePath = $_FILES['file']['tmp_name']; // Storing source path of the file in a variable
  $targetPath = "upload/".$_FILES['file']['name']; // Target path where file is to be stored
  move_uploaded_file($sourcePath,$targetPath) ; // Moving Uploaded file
    echo '0';
  }
  }
  }
  else
  {
  echo '-3';
  }
}
?&gt;


  [1]: http://stackoverflow.com/questions/36183350/why-jquery-image-uploader-doesnt-upload-image
  [2]: http://kod.djpw.cz/vpvb
</code></pre>

<p>So no html is send, just a 1 or two characters. When I check Firefox console on "Net" tab I see Just JSON but nothing more. So I have two questions here. Why I see no response, why I don't se the "0" when the file has been successfully uploaded? And then - how to fix the JS code to get the number or string without using any tags. Is this possible? My goal is to start functions which will print reports "File successly loaded" if the value is "0", or some error message if the value is less then 0.</p>
