title: PHP : got a json parse error
body: <p>I want to import data from the database into my javascript code, using ajax through jQuery, but I got a json parse error and I really don't know what it does come from. Could you help me ?  </p>
  
  <p>The goal is to build buildings on a map, and i take the geometry elements such as coordinates and shape parameters from the database.</p>
  
  <p>in the JS file,  put: </p>
  
  <blockquote>
  <pre><code> $.ajax({ 
  
    type: "GET",
    url: "ajax_processor.php",
    dataType : "html",
  
    error:function(msg, string){ 
       alert( "Error !: " + string );
    }
  
    success:function(returnData){ 
  
       var data = $.parseJSON(returnData); 
  
       for(var ID_geometryElement  in data) {
            addComp($data[bldg], 
                    $data[iZ], // zone where is the building
                    $data[iType], //type of the geometric element
                    $data[x0],
                    $data[y0],//coordinates top-left
                    $data[p], // geometric parameters
                    );
       }
     }
   });
  </code></pre>
    
    <p>});</p>
  </blockquote>
  
  <p>in the PHP file: </p>
  
  <blockquote>
    <p>
  
  <pre><code>try {
     $bdd = new PDO('mysql:host=localhost;dbname=building_geometry','admin','password');
  }
  
   $reponse = $bdd-&gt;query('SELECT * FROM ID_GEOMETRYELEMENT');
   $donnees = $reponse-&gt;fetch(); 
  
    header('Content-Type: application/json'); 
    echo json_encode($response); 
  
    ?&gt;  
  </code></pre>
  </blockquote>