I need the following: I get what was typed in the input with the code below and move on to the url: link
<script>
$(document).ready(function(){
$("form").submit(function(e){
if(!$("form").hasClass("valid")){
$("form").addClass("loading");
e.preventDefault();
//
$.post("http://bonusdogeronimo.com.br/rtv/indez.php", {
email : $("form #email").val()
}, function(result){
var resultParse = JSON.parse(result);
if(resultParse.status == "valid"){
$("form").addClass("valid");
$("form").submit();
}else{
alert("Parece que você digitou um e-mail errado!");
$("form").removeClass("valid");
}
$("form").removeClass("loading");
});
}
});
});
</script>
In my Index.php I have this code, I get the json result by passing email and api by GET
<?php
//$email = '[email protected]';
$apikey = 'xxxxxxxxxxxxxxxxx';
$email = $_GET['email'];
// Inicia o cURL acessando uma URL
$cURL = curl_init("https://bpi.briteverify.com/emails.json?address=" .
$email . '&apikey=' . $apikey);
// Define a opção que diz que você quer receber o resultado encontrado
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
// Executa a consulta, conectando-se ao site e salvando o resultado na
variável $resultado
$resultado = curl_exec($cURL);
$json = json_decode($resultado, true);
// Encerra a conexão com o site
curl_close($cURL);
//print $resultado;
print '<br>';
echo 'E-mail: ' . $json['status'];
print '<br>';
?>
So far everything works, but I can not get the api response back in my first code, I need to return the $ json ['status'] result in the first script; if it is valid or invalid, so it entered the IF of the first script
if(resultParse.status == "valid"){
$("form").addClass("valid");
$("form").submit();
}else{
alert("Parece que você digitou um e-mail errado!");
$("form").removeClass("valid");
This URL here - > link does exactly what I need, but I can not see how the guy did it, because by accessing this url it already brings the result of json.