无法从php中调用Ajax调用中的json数据

I'm able to convert my data into JSON format in php and while sending that data to Ajax call, I'm not able to get the details. In fact first the length of Json data shows 87, where it is actually 2.

My php code is

// credentials of MySql database.
$username = "root";
$password = "admin";
$hostname = "localhost"; 

$data = array();
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
  or die("Unable to connect to MySQL");

$selected = mysql_select_db("Angular",$dbhandle)
or die("Could not select Angular");
//execute the SQL query and return records
$result = mysql_query("SELECT id,name,password FROM User");

//fetch tha data from the database  
while ($row = mysql_fetch_array($result)) {

    $id = $row{'id'};
    $name = $row{'name'};
    $password = $row{'password'};
    $data[] = array('id' => $id, 'name' => $name, 'password' => $password);
}
echo json_encode($data);

Output it shows is

[
    {
        "id": "1",
        "name": "Rafael",
        "password": "rafael"
    },
    {
        "id": "2",
        "name": "Nadal",
        "password": "nadal"
    }
]

My Ajax call is

$.ajax({
    type: "GET",
    url: "ListUsers.php",
    success: function (dataCheck) {
        console.log(dataCheck.length);
        for(index in dataCheck) {
            /*
            console.log("Id:"+dataCheck[index].id);
                            console.log("Name:"+dataCheck[index].name);
                            console.log("Password:"+dataCheck[index].password);*/

        }
    },
    error: function () {
        alert("Error");
    }
 });

Please let me know if there is any thing wrong in my code

set the dataType to 'JSON' and you are all set:

$.ajax({
  type: "GET",
  url: "ListUsers.php",
  success: function (dataCheck) {
    /* ... */
  },
  error: function () {
    alert("Error");
  },
  dataType: 'JSON'
});

The dataCheck inside success() is a string. You must convert it like this:

var data = $.parseJSON(dataCheck);

Now you can use it in you for loop like

data.forEach(function(item){

console.log(item.name)

});

This should be your Ajax call:

$.ajax({
    type: "GET",
    url: "ListUsers.php",
    success: function (dataCheck) {
           var data = $.parseJSON(dataCheck);
           $(data).each(function(item){
                    console.log(item.name);
           });       
    },
    error: function () {
        alert("Error");
    }
 });