I am creating a file that displays a json file using AJAX. The problem I have right now is it only prints the first row, I want it to print all 4 rows. I tried adding another print statement under my original one in json.php but that just caused errors.

Here is the function for json in my index.html file

```
function getJSON() {
        var xmlHttp = xmlHttpObjCreate();
        if (!xmlHttp) {
                alert("The browser doesn't support this action.");
                return;
        }

        xmlHttp.onload = function() {
                if (xmlHttp.status == 200) {

                        // Get Response Text
                        var response = xmlHttp.responseText;

                        // Prints the JSON string
                        console.dir(response);

                        // Get div object
                        var divObj = document.getElementById('dinoJSON');

                        // We used JSON.parse to turn the JSON string into an object
                        var responseObject = JSON.parse(response);

                        // This is our object
                        console.dir(responseObject);

                        // We can use that object like so:
                        divObj.innerHTML = responseObject.name + " lived during the " + responseObject.pet;

                }
        }

        xmlHttp.open("GET", "json.php", true);
        xmlHttp.send();
}

```

json.php 

```
<?php
    // Print the json
    $result = array('name' => 'Staurikosaurus', 'pet' => 'Triassic');
    $result2 = array('name' => 'Diplodocus', 'pet' => 'Jurassic');
    $result3 = array('name' => 'Stegosaurus', 'pet' => 'Jurassic');
    $result4 = array('name' => 'Tyrannosaurus', 'pet' => 'Cretaceous');

    print json_encode($result);

?>

```

ajax.js

```
function xmlHttpObjCreate() {
 var xmlHttp;
 try
  {
    xmlHttp=new XMLHttpRequest();
  }
 catch (e)
  {
    try
 {
 xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
 }
 catch (e)
 {
 try
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 catch (e)
  {
  return false;
      }
    }
  }
  return xmlHttp;
 }

```

so right now when the button is pressed my program displays this:

```
Staurikosaurus lived during the Triassic

```

and I want my program to display this

```
Staurikosaurus lived during the Triassic 
Diplodocus lived during the Jurassic 
Stegosaurus lived during the Jurassic 
Tyrannosaurus lived during the Cretaceous

```