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

102
Visualizações
Html video shows white screen when added dynamically using ajax

Using jQuery, I'm sending an AJAX request that will send back JSON data with HTML code. The html code will then be appended to the document's body. Here is what I'm doing:

$.get('get.php', { req: 'video_html' }, function (data) {

    if (data.responsetype === "SUCCESS") {

        $(document.body).append(data.video_html);
    }
});

The video_html code is as following:

<video id="newVideo" src="http://.... .mp4" preload="yes">
    Your browser does not support video playing.
</video>

The video is added to the document body successfully, the URL (src attribute) is also linked properly to the video but it shows a white screen instead. Anyone knows why?

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I added a timeout and it worked:

$.get('get.php', { req: 'video_html' }, function (data) {

    setTimeout(function(){

        if (data.responsetype === "SUCCESS") {

            $(document.body).append(data.video_html);
        }

    }, 1000);
});
about 4 years ago · Santiago Trujillo Relatório
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