Typo3 6.x扩展缓存问题,extbase eID ajax数据传递给modal
来自ajax json的数据很好,并且是最新的,但是在我的模式中显示的数据是来自第一个页面加载的数据。console.log中的数据不正确。似乎是个棘手的问题Typo3 6.x扩展缓存问题,extbase eID ajax数据传递给modal,ajax,extbase,eid,Ajax,Extbase,Eid,来自ajax json的数据很好,并且是最新的,但是在我的模式中显示的数据是来自第一个页面加载的数据。console.log中的数据不正确。似乎是个棘手的问题 $('.showCallhistory').click(function(e) { var callsId = $(this).data("id"); $.ajax({ cache: false, url : '?eID=ajaxDispatcher&
$('.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">×</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>
问题在于:
$('.replaceMe').replaceWith(callhistoryhtml);
现在改用以下方法,这将带来所需的效果:
$('.replaceMe').empty();
$('.replaceMe').append(callhistoryhtml);
有什么更好的方法吗?刚刚意识到问题出在$'.replaceMe'.replaceWithcallhistoryhtml;我现在使用$'.replaceMe'.empty;$'.replaceMe'.appendcallhistoryhtml;这就像威士忌一样有效