Path to Ajax request

My mistake, i forgot to set the $this->callback to my plugin config.

the onPagesInitialized function:

public function onPageInitialized() {
    // initialize with page settings (post-cache)
    $this->initSettings($this->grav['page']);

    // Process vote if required
    if ($this->callback === $this->grav['uri']->path()) {

        // try to add the vote
        $result = $this->addVote();

        echo json_encode(['status' => $result[0], 'message' => $result[1]]);
        exit();
    }
}