0
In the login I ask the user to put the email and Cpf, then I have an api that plays data in a table that I created, then I need to take the parameters Cpf and email to put in the api.
Ex:
http://8080/rest/apiCODCPF=02798477425&EMAIL=fulano%40fulano.com.br
How can I take email and Cpf data and play as a parameter in the api?
I just have the api link, I have nothing else
Code to show the api data:
function load(){
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://localhost/r/TRCKCLI?CODCPF=12345678901&EMAIL=fulano%40email.com");
xhr.addEventListener("load", function() {
var resposta = xhr.responseText;
// console.log("ola1");
var clientes = JSON.parse(resposta);
// console.log("ola2");
// console.log(clientes);
for (var i =0; i < 1; i++){
// console.log("ola3");
var clientes_1 = clientes.TRACKER[i];
AdicionaNome(clientes_1);
AdicionaCPF(clientes_1);
AdicionaProduto(clientes_1);
AdicionaCidade(clientes_1);
AdicionaCodigoProduto(clientes_1);
AdicionaCodigoCliente(clientes_1);
AdicionaStatus(clientes_1);
ActiveStatusImage(clientes_1);
ActiveOnlyPostagem(clientes_1);
adicionaClienteNaTabelaViagem(clientes_1);
ActiveQtdViagem(clientes_1);
}
});
xhr.send();
}
window.onload = load;
This API you created? Did someone create and tell you to consume it? If it’s a third party, you have to know how it is: GET/POST, what you went through would be via GET. Another detail, the link looks like this: 'http://8080/Rest/apiCODCPF', it wouldn’t be 'http://nameplate:8080/Rest/api/', you can see that putting the localdaapi name and a bar after the word API.
– Max Rogério
Exactly, they created and ordered me to consume her
– Maria
I completed my comment above...
– Max Rogério
The link I put in the api is modified, just an example, you know? I knew how to consume it and show the data on the site, only I need to put Cpf and email as a parameter, as I said in the question
– Maria
Put the code of what you’re trying to...
– Max Rogério
Ready. That’s how I can show the api on the site (api data)
– Maria
Let’s go continue this discussion in chat.
– Max Rogério