내가 jQuery를 .load()
이 문제가 클릭하면 이전 페이지 :jQuery를로드로드 A가
내가 테스트 페이지라는 a.php에 있고 거기에 :
sleep(5);
는 그래서 5 잠을 초. 내 jQuery에서 해당 페이지가로드되기 시작하고 다른 링크를 클릭하면 해당 페이지가로드되고 이전 페이지가로드 된 직후에로드됩니다.
어쨌든 중지 할 수 있습니까?
코드는 다음과 같습니다 :
jQuery(document).ready(function(){
$("#load").hide(); //Hife the loading bar
$("a").click(function(){ //On click
if(!$(this).hasClass('ignoreJS'))
{
$("#load").show();
$("#mainContent").hide();
addActive(this);
var FullAttribute = $(this).attr('href');
var FinalAttribute = FullAttribute.slice(1);
$('#mainContent').load(FinalAttribute + '.php', function(response, status, xhr)
{
if(status)
{
if(status == 'error' && xhr.status != 0)
{
$('#mainContent').html('<h2 class="errorText">Error ' + xhr.status + ' </h2>');
}
waitingToLoad = false;
}
$("#mainContent").show();
$("#load").hide();
});
}
});
가능한 한 [jquery.load()를 취소하는 방법?] (http://stackoverflow.com/questions/2813168/how-to-cancel-a-jquery-load) – hexblot
@hexblot 내가 찾고있는 항목 내 문제에 대한 해결책이 아니고 대안 인 – Krixxix
이 아닙니다. jquery.load가 생성 한 http 요청을 중지하는 것과 관련된 질문입니다. – hexblot