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

240
Visualizações
problem with showing values of my array with document.write (using HTML 5 QR Code Scanner)

I am trying to work with HTML 5 QR Code scanner foran attendance system. Well I got that far, that I can scan QR Codes and push them into an array. I can see the values of the array in the console. Now I want that this array is shown below the QR Code Reader in my browser view. I then want a form to submit my javascript array values to a PHP Code to use it with mysql (Don`t know how to do that right know... :) )

My first problem: my html page is not showing anything.. it is supposed to show the values of my Code array:

    <script>
var codeslz = [];

function onScanSuccess(decodedText, decodedResult) {
  // handle the scanned code as you like, for example:
  //console.log(`Code matched = ${decodedText}`, decodedResult);
    if(codeslz.indexOf(decodedText) !== -1){    
    } else{
        codeslz.push (decodedText);
    }   
  console.log (codeslz);
  return codeslz;
}

function onScanFailure(error) {
  // handle scan failure, usually better to ignore and keep scanning.
  // for example:
  //console.warn(`Code scan error = ${error}`);
}

let html5QrcodeScanner = new Html5QrcodeScanner(
  "reader",
  { fps: 10, qrbox: {width: 350, height: 350} },
  /* verbose= */ false);
html5QrcodeScanner.render(onScanSuccess, onScanFailure);

for(var i = 0; i < codeslz.length; i++){
    document.write(codeslz[i] + "<br>");
}  
</script>

Later I want to automatically let the shwoing of my array be reloaded, so the user can always see the actual values of the complete array codeslz.

I think there must be sth wrong with my array codeslz. When I fill the array like this, it works without any problems:

<html>
<head>
</head>
<body>
<script>
var codeslz = ["This", "is","a", "Test"];
for(var i = 0; i < codeslz.length; i++){
    document.write(codeslz[i] + "<br>");
}  
</script>
</body>
</html>

I hope someone can help me. Thanks!!!! Kind regards Dan

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