没有使用AJAX获得数据

This is the data I'm trying to get

public function dohvatiZadatak($id){
    $this->id = $id;
    $conn = $this->connect()->prepare("SELECT * FROM zadatci WHERE id=:id");
    $conn->bindParam('id', $this->id);
    $conn->execute();
    $zadatak = $conn->fetch(PDO::FETCH_ASSOC);
    return json_encode(array('zadatak' => $zadatak));
}

Ajax request

function urediZadatak(id){
      $("#uredi-zadatak-modal").modal('show');
      $.ajax({
         type: "GET",
         url: "../zadatci/uredizadatak.php?id="+id,
         data: id,
         async: false,
         success: function(response){
             console.log(response.zadatak);
         }
       });
 }

I'm getting nothing in return. How do I get that data I'm returning with PHP?

In order for the response to be sent back from PHP you need to use echo. On your code you should add the following to the place calling dohvatiZadatak($id):

echo dohvatiZadatak($id);

And than on your front-end you can use:

function urediZadatak(id){
    $("#uredi-zadatak-modal").modal('show');
    $.ajax({
        type: "GET",
        url: "../zadatci/uredizadatak.php?id="+id,
        data: id,
        async: false,
        success: function(response){
            var parsedResponse = JSON.parse(response);
            // use the response as parsedResponse.key
        }
    });
 }

Based on the comment thread above...

Your function returns a result:

return json_encode(array('zadatak' => $zadatak));

But you're not printing that result to the output:

$zadatak->dohvatiZadatak($id);

All you need to do is print it to the output:

echo $zadatak->dohvatiZadatak($id);