1
I have the following excerpt:
"onclick=relatorio("+dados[i].cnpj+")"
data[i]. cnpj is a String type variable, or at least need it to be so, but Javascript converts the function parameter into a type number logo:
function relatorio(cnpj) {
console.log(cnpj);
}
problem: when I need to make an ajax for the bank, the values differ
question: What could you do to ensure that data[i]. cnpj continued with the string type?
I do not have permission from the client to disclose Cnpjs so it was censored even, but as you can see there the zero left was concatenated when the data type was changed
In addition to Wallace’s response, you can also use the
cnpj.toString()
.– Icaro Martins