我想在点击事件上刷新容器。对于此任务,我创建一个函数并在按钮属性中调用它。但是当我点击它然后它给了我这个错误ReferenceError: load is not defined
<input type="button" value="Choose Container" data-toggle="modal" data-target="#myModal" class="sidebar-button" onclick="loadDiv();"/>
<div class="modal-content custom-popup-personalize">
<div class="modal-header">
<h4 class="modal-title">Container Slides</h4>
</div>
<div class="modal-body custom-personalize">
<div id="slider" class="flexslider ">
<ul class="slides loadOne">
<?php if(is_array($cookiProductsArray)){
if($cookiProductsArray){
foreach($cookiProductsArray as $cProduct){
?>
<li>
<img src="<?php echo $cProduct['popImage']; ?>" />
<div class="pop-prodcut-details">
<h3><?php echo ucwords($cProduct['name']); ?></h3>
<p><?php echo $cProduct['description']; ?></p>
</div>
</li>
<?php }
}else{?>
<span class="empty-container">Container is Empty!</span>
<?php }
}?>
</ul>
</div>
</div>
</div>
function loadDiv(){
load(window.location + " .custom-popup-personalize");
}
任何人都可以指导我,我可以解决这个问题。
答案 0 :(得分:0)
因为脚本中未定义load()
函数。如果是自定义函数,则需要定义它。如果您尝试使用jquery load()
函数,则需要指定容器div以将内容加载到其中。像这样:
$('#divId').load(url)