json编码数据没有得到Ajax成功检查我的代码

I want to fetch data from database and display into HTML table but ajax URL don't call PHP page and don't get data on success.

Ajax Call: I did not get JSON encoded data on success.

$.ajax({
            url : 'FETCH.PHP',
            dataType:'json',
            contentType: "application/json",
            success: function (data) {
               var data = JSON.stringify(data);

                var html = "";
            for(var a = 0; a < data.length; a++) {
                var firstName = data[a].firstname;
                var email = data[a].email;
                alert(email);

                html += "<tr>";
                    html += "<td>" + firstName + "</td>";
                    html += "<td>" + email + "</td>";
                html += "</tr>";
               document.getElementById("data").innerHTML += html;
              }
            },
            error: function(xhr, textStatus, error){
                alert(xhr.statusText);
                alert(textStatus);
                alert(error);
              }

     });

This is my PHP code page I want to move here using ajax call ==> FETCH.PHP page

<?php
print_r("Hello");
include_once('database/db.php');

$getUsers = $connect->prepare("SELECT * FROM registration ORDER BY id ASC");
$getUsers->execute();
//$users = $getUsers->fetchAll();

$users = $getUsers->fetchAll(PDO::FETCH_ASSOC);

$items = array();
foreach($users as $u) {
    //print_r($u);
 $items[] = $u;
}
var_dump(json_encode($items);
exit(); 
?>

Remove two things from ajax call and run my code. dataType:'json', contentType: "application/json",

==>revised Code

$.ajax({
        url : 'check.php',
        success: function (data) {
        data = $.parseJSON(data);
           }
        )};

==> i converted json encoded string into array using $.parseJSON.

Get rid of all the output except for echoing the JSON.

There's also no need for the foreach loop. $items is just a copy of $users.

<?php
include_once('database/db.php');

$getUsers = $connect->prepare("SELECT * FROM registration ORDER BY id ASC");
$getUsers->execute();

$users = $getUsers->fetchAll(PDO::FETCH_ASSOC);
echo json_encode($users);
exit(); 
?>