title: Display PHP Errors Within a Requested Page
body: <p>I have a some Ajax on a PHP page which requests another PHP page a bunch of times to process part numbers and return certain information. The only problem is when I accidentally make some sort of PHP error on the page it is requesting I have no idea of knowing what I did wrong on the PHP page because the console just returns "undefined" when I try to use console.log(response.my_var); to print response variables in the console. How do I debug my PHP page that is being requested? I cannot seem to get the PHP to return any errors, it just crashes and JavaScript returns those undefined response variables. Is there a way for me to access the PHP errors that should be being generated? Here is the Ajax Request Code I am using:</p>
  
  <pre><code>function imagething(){
  if(!done) {
      var url = "process_parts.php";
  
      $.ajax({
          //async: false, defaults to async
          url: url,
          type: 'POST',
          data: {
              offset: offset,
              limit: limit,
              parts: parts,
              part_delimiter: part_delimiter,
              diagram_format: diagram_format
          } 
      }).done(function(response) {
          //This is what produces "undefined"--&gt; console.log(response.part_delimiter);
          if (response.processed !== limit) {
              // asked to process 20, only processed &lt;=19 - there aren't any more
              done = true;
          }
          if(response.table_data != '') {
              $('#myTable &gt; tbody:last').append(response.table_data);
          }
          if(response.image_format != '') {
              $('#third_th').append(" (format: "+response.image_format+")");
              $('#fourth_th').append(" (format: "+response.diagram_format+")");
              $('#fifth_th').append(" (format: "+response.pdf_format+")");
          }
          offset += response.processed;
          $('[data-toggle="tooltip"]').tooltip({'placement': 'top'});
          $("#mybox").html("&lt;span class=\"color_blue\"&gt;Processed a total of " + offset + " parts.&lt;/span&gt;");
          imagething(); //&lt;--------------------------recursive call
      }).fail(function(jqXHR, textStatus) {
  
          $("#mybox").html("Error after processing " + offset + " parts. Error: " + textStatus);
  
          done = true;
      });
  }
  }
  imagething();
  </code></pre>