Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

201
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!