0
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Title</title>
</head>
<body>
<form>
<input type="email" name="email" placeholder="email">
<button type="button" id="send">enviar</button>
</form>
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script type="text/javascript">
$('#send').on('click', function(){
$.ajax({
url: "URL QUE RETORNA O TOKEN",
method: "post",
contentType: "application/json",
data: '{ "email": "[email protected]" }',
success: function (data) {
console.log(data);
}
});
});
</script>
</body>
</html>
NOTE: console.log(data); ME RETURNS THE TOKEN PERFECTLY
I agree, but it can be as simple as possible (a variable for example), for testing purposes.
– Sergio Bentes
You can suggest a method that the token does not get lost in a variable?
– Sergio Bentes