Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

129
Visualizações
Data not sending from XMLHttpRequest

I have an XMLHttpRequest with which I want to send a string, but it receives array(0) in the alert, before with x-www-form-urlencoded and without stringify it worked but it didn't receive the data in the post, but now not even that , but I have read that it is how it should be done to send a string, then I leave you the JS and the .php so you can see it, thank you very much in advance :)

var img = chartR.toDataURL("image/png");
document.getElementById('base64').value = img;
var xhttp=new XMLHttpRequest();
xhttp.onreadystatechange = function() {
    if (xhttp.readyState == XMLHttpRequest.DONE) {
        alert(xhttp.responseText);
    }
}
xhttp.open("POST", base_url_admin+"record/reporte", true);
xhttp.setRequestHeader("Content-type", "application/json");
let data = JSON.stringify({"resultChartImg": img});
xhttp.send(data);
$resultChartImg = $_POST;
var_dump($resultChartImg);exit();
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda