Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

204
Vistas
How can I display informations from DB on my HTML page on cloned section?

I use SQL and PHP pure for backend and HTML CSS JS for the front.

In my HTML file, I have a section tag part which contains a data from my DataBase which must be displayed on the front.

My problem is that when I clone the section part using "Clone Node", the data from the database are not cloned and by the way is not diplayed...

You can see my code here for import data from my SQL table.

$.ajax({
type: "GET",
url: "backend-script.php",
dataType: "html",
success: function(data){
    var val = 0;
    var data_j = JSON.parse(data);
    $("#table-container").html(data_j[0]['title_advertisement']);
    }
})

Here the section cloned:

<section class="py-5">
        <div class="container px-4 px-lg-5 mt-5">
            <div class="row gx-4 gx-lg-5 row-cols-2 row-cols-md-3 row-cols-xl-4 justify-content-center">
                <div class="col mb-5">
                    <div class="card h-100">
                        <!-- Product image-->
                        <img class="card-img-top" src="https://dummyimage.com/450x300/dee2e6/6c757d.jpg" alt="..." />
                        <!-- Product details-->
                        <div class="card-body p-4">
                            <div class="text-center">
                                <!-- Product name-->
                                <h5 class="fw-bolder">
                                    <div id="table-container"></div>

                                </h5>
                                <!-- Product price-->
                            </div>
                        </div>
                        </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <script>

The important line here is

<div id="table-container"></div>

Beacuse it's the moment where I call the data from my DB to be displayed on the screen.

I copy paste the section part here :

<script>
        var i = 0;
        while (i < 5) {
            var elmnt = document.getElementsByTagName("section")[0];
            var cln = elmnt.cloneNode(true);
            console.log(cln);
            document.body.appendChild(cln);
            i++;
        }
</script>

Thank you by advance !

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda