dsgs8208 2016-08-29 08:47
浏览 45

如何通过jquery刷新多个DIV

I have made a media gallery for website where i am using images from previous uploads. but i have created multiple folder in my media/ folder like gallery-images, hotel-images etc.

now i want to refresh a particular div where i upload a image like if i upload file in hotel-images, then refresh only hotel-images display tab div

Here is my code :

<h4 class="md-total-img">Total  
<?php
echo $fol = $_POST['val'];
$filecount = 0;
$file = glob("$fol/*.*");
if ($file){
$filecount = count($file);
}
echo "($filecount) files";
?>
</h4>

<div class="md-search-img">
<button id="MyButton" data-name="<?php echo $fol; ?>" class="btn btn-warning">Refresh</button>
</div>

Here is Javascript:

$(document).ready(function(){
$('#MyButton').on('click', function() {
var ref_folder = $(this).attr("data-name");
alert(ref_folder);

$.ajax({
type:"POST",
url: "media/media-ajax.php",
data:{val:ref_folder},
cache: false
})
.done(function( html ) {
if(ref_folder == 'hotels'){
$( "#hotelsview" ).html( html );
alert(ref_folder);
}
if(ref_folder == 'gallery'){
$( "#galleryview" ).html( html );
alert(ref_folder);
}
});
});

Can anyone help me to do like this ?

  • 写回答

1条回答 默认 最新

  • doucanrui1735 2016-08-29 08:54
    关注

    If you want to add email as an array so you should make the variable array first like $email= array(); after declare the variable into array then you can add $email = $_POST['email'];

    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测