I have made a template that I would like to load in using jQuery .load() function. When testing I found out that it won't load any .
我已经创建了一个模板,我希望使用jQuery .load()函数加载它。测试时我发现它不会加载任何东西。
Here is my load code:
这是我的负载代码:
function open() {
history.pushState(null, null, "artiesten.php?u=Chato De Veirman");
$('.content').load('artiest_template.php .content');
}
Here is my template code:
这是我的模板代码:
<?php include('includes/connect.php') ?>
<span class="content">
<div class="right_col" role="main">
<div class="">
<script>alert("nothing")</script>
<div class="row" id="groot">
<div class="col-md-4 col-sm-2 col-xs-12 profile_details">
</div>
<div class="col-md-4 col-sm-8 col-xs-12 profile_details">
<div class="well profile_view">
<div class="col-sm-12">
<h4 class="brief a-titel"><i>Panda 2.0</i></h4>
<div class="left col-xs-7">
<h2 class="a-naam">Laurent Meersman</h2>
<p><strong>Over: </strong><span class="a-over"> Te weinig tijd / Grafische artiest / Gek </span></p>
<ul class="list-unstyled">
<li><i class="fa fa-user"></i> Kernmerk: <span class="a-kernmerk">Gek</span></li>
<li><i class="fa fa-envelope-o"></i> Email: <span class="a-email"><a href= "mailto:laurent.meersman@oc.be">laurent.meersman@oc.be</a></span></li>
</ul>
</div>
<div class="right col-xs-5 text-center">
<img src="images/Laurent Meersman.jpg" alt="" class="img-circle img-responsive a-foto">
</div>
</div>
<div class="col-xs-12 bottom text-center">
<button type="button" class="btn btn-info btn-xs">
<i class="fa fa-video-camera"> </i> Bekijk meer video's.
</button>
</div>
</div>
</div>
</div>
<div class="row" id="klein">
<div class="col-md-2 col-sm-2 col-xs-12 profile_details">
</div>
<div class="col-md-8 col-sm-8 col-xs-12 profile_details">
<div class="well profile_view">
<div class="col-sm-12">
<h4 class="brief a-titel"><i>Panda</i></h4>
<div class="left col-xs-7">
<h2 class="a-naam">Laurent Meersman</h2>
<p><strong>Over: </strong><span class="a-over"> Te weinig tijd / Grafische artiest / Gek </span></p>
<ul class="list-unstyled">
<li><i class="fa fa-user"></i> Kernmerk: <span class="a-kernmerk">Gek</span></li>
<li><i class="fa fa-envelope-o"></i> Email: <span class="a-email"><a href= "mailto:laurent.meersman@oc.be">laurent.meersman@oc.be</a></span></li>
</ul>
</div>
<div class="right col-xs-5 text-center">
<img src="images/Laurent Meersman.jpg" alt="" class="img-circle img-responsive a-foto">
</div>
</div>
<div class="col-xs-12 bottom text-center">
<button type="button" class="btn btn-info btn-xs">
<i class="fa fa-video-camera"> </i> Bekijk meer video's.
</button>
</div>
</div>
</div>
</div>
<?php
echo '<script>alert("' . $_GET['u'] . ' or nothing")</script>';
if($_GET['u']){
$t = mysqli_real_escape_string($connect,$_GET['u']);
$res = mysqli_query($connect, "SELECT * FROM artiesten WHERE Naam='" . $t . "'");
$i = mysqli_fetch_assoc($res);
echo '
<script src="vendors/jquery/dist/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$(".a-titel").html("' . $i['Titel'] . '");
$(".a-naam").html("' . $i['Naam'] . '");
$(".a-over").html("' . $i['Over'] . '");
$(".a-kernmerk").html("' . $i['Kernmerk'] . '");
$(".a-email").html("' . $i['Email'] . '");
$(".a-foto").attr("src", "images/' . $i['Naam'] . '.jpg");
history.pushState(null, null, "?u=' . $i['Naam'] . '");
});
</script>';
}
?>
</div>
</div>
</span>
Can somebody help me with this? Thanks in advance.
有人能帮我吗?提前谢谢。
2 个解决方案
#1
0
Should be
应该是
function open() {
history.pushState(null, null, "artiesten.php?u=Chato De Veirman");
$('.content').load('artiest_template.php');
}
not
不
function open() {
history.pushState(null, null, "artiesten.php?u=Chato De Veirman");
$('.content').load('artiest_template.php .content');
}
#2
0
jQuery load() takes three parameters, URL, data and a function. These parameters have to be separated by a coma. Your load() has something behind your URL that is not part of the URL.
jQuery load()包含三个参数、URL、数据和一个函数。这些参数必须由昏迷来区分。您的load()在URL后面有一些不属于URL的内容。
Change
改变
$('.content').load('artiest_template.php .content');
to
来
$('.content').load('artiest_template.php');
#1
0
Should be
应该是
function open() {
history.pushState(null, null, "artiesten.php?u=Chato De Veirman");
$('.content').load('artiest_template.php');
}
not
不
function open() {
history.pushState(null, null, "artiesten.php?u=Chato De Veirman");
$('.content').load('artiest_template.php .content');
}
#2
0
jQuery load() takes three parameters, URL, data and a function. These parameters have to be separated by a coma. Your load() has something behind your URL that is not part of the URL.
jQuery load()包含三个参数、URL、数据和一个函数。这些参数必须由昏迷来区分。您的load()在URL后面有一些不属于URL的内容。
Change
改变
$('.content').load('artiest_template.php .content');
to
来
$('.content').load('artiest_template.php');