0
아래 코드를 사용하여 작동하는로드 이미지가 있습니다. 그것은 살아 움직이는듯한 gif를 보여 주며 html이 URL에서 가져 오기를 기다립니다. 가져 오면로드 div가 숨겨지고 html이 bite div에로드됩니다. 반환 된 html은 모두 jQuery Tabs에 포함되어 있지만 html이 표시되면 탭이 렌더링되지 않고 li 요소 만 표시됩니다.Ajax에서 jQuery 탭로드
AJAX를 통해 jQuery 탭이 들어있는이 html을 가져 와서이 탭을 렌더링 할 수 있습니까? 그렇다면 내가 뭘 잘못하고 있니?
<div id="loader" style="text-align:center; display:none;">
<img src="img/ajax-loader.gif" alt="LOADING" />
</div>
<div id="bite"></div>
$(document).ready(function() {
$('#loader').show();
$.ajax({
url:'http://www.domain.com/bitesized/main.php?uid=<?php echo $uid; ?>',
complete: function(data){
$('#loader').hide();
$('#bite').html(data.responseText);
// these divs ids are available after the load above and are meant to render the tabs
$("#tabs").tabs();
$("#fragment-a").tabs();
}
});
});
나는 그 코드에 이상한 점을 발견 할 수 없다. 아마도'data.responseText'가 당신이 기대하는 HTML을 정확히 포함하고 있는지를 검증 할 수 있습니까? –
그것은, 나는 경고를했고 그것은 올바른 html입니다. 어쨌든 나는 그것을 지금 풀었다. 위의 코드가 작동하면 브라우저 캐시가 실현되었습니다. ( – Martin
또 다른 메모에서 아마 jQuery Ajaxy http://balupton.com/projects/jquery-ajaxy에 관심이있을 것입니다. 아약스 및 히스토리 지원을 쉽게 허용합니다. 이 유형의 물건은 - 두 번 코딩하지 않아도됩니다. – balupton