2014-02-27 52 views
0

来自ajax(json)的数据很好并且是最新的,但是显示在我的模式中的数据是来自第一页加载的数据。 “console.log”中的数据是正确的。似乎是一个chache问题?Typo3 6.x扩展缓存问题传递给模态的extbase eID ajax数据

$('.showCallhistory').click(function(e) { 
     var callsId = $(this).data("id"); 
     $.ajax({ 
      cache: false, 
      url : '?eID=ajaxDispatcher&callId='+callsId, 
      dataType : 'json', 
      success : function(data) { 
       var callhistoryhtml = ''; 
       callhistoryhtml +='<div class="well"><dl class="dl-horizontal">'; 
       $.each(data, function(i, val) { 
        callhistoryhtml += '<dt>'+val.chCrdate+'</dt><dd>'+val.chEntry+' | durch: '+val.feUsername+'</dd>'; 
        console.log(val.chEntry + ' : ' + val.chCrdate+ ' : ' + val.feUsername); 
       }); 
       callhistoryhtml += '</dl></div>'; 
       $('.replaceMe').replaceWith(callhistoryhtml); 
       $('#myModal').modal('toggle'); 
      }, 
      error : function(result) { 
       alert('error ' + result.myResult); 
      }, 
     }); 
    }); 

我的模式,其中的内容不正确的更换:

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" 
    aria-labelledby="myModalLabel" aria-hidden="true"> 
    <div class="modal-dialog"> 
     <div class="modal-content"> 
      <div class="modal-header"> 
       <button type="button" class="close" data-dismiss="modal" 
        aria-hidden="true">&times;</button> 
       <h4 class="modal-title" id="myModalLabel">Call-Historie</h4> 
      </div> 
      <div class="modal-body replaceMe">...</div> 
      <div class="modal-footer"> 
       <button type="button" class="btn btn-primary" data-dismiss="modal">schliessen</button> 
      </div> 
     </div> 
    </div> 
</div> 
+0

刚刚意识到问题是$('。replaceMe')。replaceWith(callhistoryhtml);我现在使用$('。replaceMe')。empty(); \t \t \t $('。replaceMe')。append(callhistoryhtml);而且这种方式的工作原理 – metaxos

回答

0

的问题是:

$('.replaceMe').replaceWith(callhistoryhtml); 

现在用下面来代替,而这带来所需的效果:

$('.replaceMe').empty(); 
$('.replaceMe').append(callhistoryhtml); 

是回复任何评论/更好的方式?