How you arrange the confirmation email?

Good day to all and a happy new year! I sit writing system for confirmation email, and the question arose as his beautifully realized. The person who clicks the link with the letters on the page with the validation, for example, the link: /validate-email/test/2055925770397152/. P. S: this is all implemented.
Further, the link passes through the test function:
public function validateMail($login, $code) {
 $doValidate = true;

 if (!empty($_SESSION['verify_last_try'])) {
 if(time() < intval($_SESSION['verify_last_try'])) {
 $doValidate = false;
 } else {
 $_SESSION['verify_last_try'] = time() + 60;
}
 } else {
 $_SESSION['verify_last_try'] = time() + 60;
}

 if ($doValidate == false) $dataContainer = ['result' => 'error', 'texterror' => 'Error: VALIDATE.WAIT'];
 else {
 if (empty($login) || empty($code)) $dataContainer = ['result' => 'error', 'texterror' => 'Error: VALIDATE.1'];
 else {
 $dataContainer = ['result' => 'error', 'texterror' => 'Error: VALIDATE.2'];
}
}

 echo json_encode($dataContainer);
 }

Here I get responses in json format. And the main question, please tell me how to do to people after clicking the link in the email were, for example, on the tration with the authorization, and the answers came via JS/jQuery with the validation function? I face it for the first time, on the even ideas are not present =(

Thanks in advance!
April 4th 20 at 00:33
1 answer
April 4th 20 at 00:35
can use Curl to call the JQuery

Find more questions by tags PHP