maybe its easy, but I'm really beginner in front end. Right now I've got:
Main html:
<!DOCTYPE html>
<html lang="en">
<head>
<link href="css/bootstrap.min.css" rel="stylesheet">
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/something.js"></script>
</head>
<body>
<div class="container-fluid well-lg">
<div id="targetInformation">
</div>
</div>
</body>
<html>
2nd html:
<div class=" col-md-4 col-sm-6 col-xs-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Some title
</h3>
</div>
<div class="panel-body">
<p>info1</p>
<p>info2</p>
<p>info3</p>
</div>
</div>
</div>
I want to: create a loop in js/jquery/ajax to load 6 times what is inside 2nd html to a first html. One thing I know is that I need to use $.get(). Any ideas how my js should look like, and how to use js in a div? Thanks :) Tried to find a solution, but didnt found, sorry for bothering
ps. I didnt send you my something.js, because its empty, really got no idea how to start.
Try This -
$(function () {
$.get("something.html", function (data) {
for(let i =0; i<6; i++)
{
$("#targetInformation").append(data);
}
});
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.