title: Integration for php with ajax
body: <p>I have a record of carriers and clients. When selecting a carrier on the customer screen, I need it to be automatically filled out the carrier's e-mail and telephone. The PHP file is returning a JSON correctly, but it is dropping in the error of jquery and not in success. I checked in Firefox's Firebug and the HTML tab of the console, where the GET requisition is reset.</p>
  
  <pre><code>&lt;?php
  include "Config/config_sistema.php";
  $res = mysql_query("SELECT * FROM transportadoras");
  $menu_items = null;
  while($ln = mysql_fetch_object($res)){
      $menu_items[] = $ln;
  }
  json_encode($menu_items);
  ?&gt;
  </code></pre>
  
  
  
  <pre><code>&lt;script&gt;
      $("body").on("change","#transportadoras",function(event){
          event.preventDefault();
          var trigger=$(this);
          $.ajax ({
              type: "POST",
              url: "buscaDadosTransportadora.php",
              dataType: 'json',
              success: function (data) {
                  $("#telefone_transp").val(data.telefone);
                  $("#email_transp").val(data.email);
              },
              error: function (data) {
                  alert("Erro");
              },
          });
      });
  &lt;/script&gt;   
  </code></pre>
  
  <p>return in ajax</p>
  
  <pre><code>[{"ID":"5","Nome":"Vinicius","email":"viniciusbalbinot91@gmail.com","telefone":"32680018"},{"ID":"6","Nome":"teste","email":"teste@teste.com.br","telefone":"12345567"}]
  </code></pre>