jQuery不显示数据

时间:2016-10-08 14:03:14

标签: jquery html mysql json

HTML CODE:

        <div class="col-sm-8" id="lists">
  <?php foreach($products as $p):?>
    <div class="col-md-12">
  <div class="product-view row" style="border-bottom:1px solid #eee;margin-bottom:20px;padding:20px 0px 20px 0px;background:#f1f1f1">
    <div class="col-sm-3 col-md-3 col-lg-3">
      <?php $j = 0;?>
        <?php foreach($p['checkbox'] as $checkbox):?>
          <?php if($j == 0):?>
            <div class="large-image"> 
                <img alt="#" src="<?php echo base_url();?>/uploads/<?php echo $checkbox['Image']?>" />
                <div class="image-title"><span class="icon-thumbs-up" style="font-size:18px;"><?php echo $p['Thumb']?></span></div> 
            </div>
          <?php endif;?>
          <?php $j++;?>
        <?php endforeach;?>
    </div>
    <div class="col-sm-6 col-md-6 col-lg-6"> 
      <div class="product-label">
          <h4><?php echo $p["FullName"];?>, <?php echo $p["Area"];?></h4>
          <h5 style="font-size:14px"><span class="icon-calendar"></span>  <?php echo $p["SaleDate"];?></h5>
          <h5 style="font-size:14px"><span class="icon-clock"></span>
          <?php for($i = 0; $i < count($p['StartTime']); $i++):?>
              <?php echo $p['StartTime'][$i].'-'.$p['EndTime'][$i]?>
          <?php endfor;?>
          </h5>
          <div data-balloon-length="fit" data-balloon=" <?php echo $p["Address1"];?>" data-balloon-pos="up"  ><h5 style="font-size:14px;width: 100%;text-overflow: ellipsis;overflow: hidden;white-space: nowrap;"><span class="icon-home"></span>  <?php echo $p["Address1"];?></h5></div>
          <div data-balloon-length="fit" data-balloon=" <?php echo $p["description"];?>" data-balloon-pos="up" ><h5 style="font-size:14px;width: 100%;text-overflow: ellipsis;overflow: hidden;white-space: nowrap;"><span class="icon-file"></span>  <?php echo $p["description"];?></h5></div>
      </div>

    </div>
    <div class="col-sm-3 col-md-3 col-lg-3">
      <div class="product-label">
          <h4>CATEGORY</h4>
          <?php foreach($p['checkbox'] as $checkbox):?>
            <h5 style="font-size:14px"><?php echo $checkbox['Product']?></h5>
          <?php endforeach;?>
      </div>

    </div>
  </div>
  </div>
  <?php endforeach;?>
  </div>
  </div>
  </div>
  </div>

JQUERY CODE:

            $.ajax({
                type:"post",
                url:"<?php echo base_url()?>index.php/myad/filter",
                data:{checkbox:checked},
                success:function(data){
        data = $.parseJSON(data);
        var list = '';
        var cates = '';
        for(var i = 0; i <= data.length; i++){
          list =+ '<div class="col-sm-12"><div class="product-view row" style="border-bottom:1px solid #eee;margin-bottom:20px;padding:20px 0px 20px 0px;background:#f1f1f1"><div class="col-sm-3 col-md-3 col-lg-3"> <div class="large-image"> <img alt="#" src="'+base_url+'/uploads/'+data[i]['cate'][0]['Image']+'"><div class="image-title"><span class="icon-thumbs-up" onclick="thumb('+data[i]['UniqueID']+',this)" style="font-size:24px;"></span></div></div></div><div class="col-sm-6 col-md-6 col-lg-6"> <div class="product-label"><h4>'+data[i]['FullName']+', '+data[i]['Area']+'</h4><h5 style="font-size:14px;width: 100%;text-overflow: ellipsis;overflow: hidden;white-space: nowrap;"><span class="icon-calendar"></span>  '+data[i]['SaleDate']+'</h5><h5 style="font-size:14px;width: 100%;text-overflow: ellipsis;overflow: hidden;white-space: nowrap;"><span class="icon-clock"></span>  ';
          var starttime = JSON.parse(data[i]['StartTime']);
          var endtime = JSON.parse(data[i]['EndTime']);
          var times='';
          for(var r = 0; r  < starttime.length; r++){
              times+=''+starttime[r]+'-'+endtime[r]+' ';
          }
          list+=times+'</h5><div data-balloon-length="fit" data-balloon="'+data[i]['Address1']+'" data-balloon-pos="up" ><h5 style="font-size:14px;width: 100%;text-overflow: ellipsis;overflow: hidden;white-space: nowrap;"><span class="icon-home"></span>  '+data[i]['Address1']+'</h5></div><div data-balloon-length="fit" data-balloon="'+data[i]['description']+'" data-balloon-pos="up" ><h5 style="font-size:14px;width: 100%;text-overflow: ellipsis;overflow: hidden;white-space: nowrap;"><span class="icon-file"></span>  '+data[i]['description']+'</h5></div></div></div><div class="col-sm-3 col-md-3 col-lg-3"><div class="product-label"><h4>CATEGORY</h4>';
          for(var j = 0;j < data[i]['checkbox'].length; j++){
            cates+='<h5 style="font-size:14px">'+data[i]['cate'][j]['Product']+'</h5>';
          }
          list+=cates+'</div></div></div></div>';
        };
        $("#lists").html(list).hide().fadeIn();
              }
          });

现在我的PHP代码出现了php数据。在更改复选框值后,我想在ID上显示数据。但它不起作用。我的复选框代码和ajax代码工作正常。它在控制台中显示JSON数据。但是对于复选框的更改它不显示ID上的数据我该如何解决?并提前感谢。

0 个答案:

没有答案