title: Displaying php result in HTML using AJAX
body: <p>I am trying to display the result of my php in different <code>&lt;div&gt;</code>-s. My plan is that I make a query in my php and display the result in JSON format. Due to the JSON format my result can be displaying in different <code>&lt;div&gt;</code>. <strong>How can I reach that for example the <code>"name"</code> can be displayed between  <code>&lt;div&gt;</code> tags?</strong></p>
  
  <p><strong>The example result of php:</strong></p>
  
  <pre><code>[
      {
          "id": 0,
          "name": "example1",
          "title": "example2"
      },
      {
          "id": 0,
          "name": "example1",
          "title": "example2"
      }
  ]
  </code></pre>
  
  <p><strong>The attempt:</strong></p>
  
  <pre><code> &lt;div class="result"&gt;&lt;/div&gt;
  
   &lt;script&gt;
   $.ajax({
      type:'GET',
      url:'foo.php',
      data:'json',
      success: function(data){
              $('.result').html(data);
      }
  });
  &lt;/script&gt;
  </code></pre>