2009-09-02 4 views
0

이 코드 :로드 기능이 작업을 완료하기 전에jQuery에 지시하는 방법 :로드가 준비되면 이것을 표시 하시겠습니까?

$("#permalink a").click(function(id){ 
var id = this.getAttribute('href'); 
$("#newPostContent").load(id, function() { 
$("#removeTrigger").click(function() { 
$("#removeThis").hideToggle(); 
$("#postSingle").hideToggle(); 
}); 
}); 
    $("#postSingle").fadeToggle(); 
    return false; 
}); 

이 #postSingle를 표시합니다. 어떻게 조정할 수 있습니까?

감사합니다.

(오늘 많은 질문, 감사합니다. 모두들 :)).

+0

남자는 약 $ .load (이야기, 사람,없는 페이지로드를 ... – ijw

답변

2

넣어 모든 것을 당신은 콜백 함수에서 load 후 발생 할 :)

$("#permalink a").click(function(id){ 
    var id = this.getAttribute('href'); 
    $("#newPostContent").load(id, function() { 
     $("#removeTrigger").click(function() { 
      $("#removeThis").hideToggle(); 
      $("#postSingle").hideToggle(); 
     }); 
     $("#postSingle").fadeToggle(); 
    }); 
    return false; 
}); 
+0

매우 간단합니다. 그것은 작동합니다! –

-1

문서 준비 블록에서 래핑을 시도해 보셨습니까? 마찬가지로 :

$(document).ready(function() { 
    $("#permalink a").click(function(id){ 
    var id = this.getAttribute('href'); 
    $("#newPostContent").load(id, function() { 
    $("#removeTrigger").click(function() { 
    $("#removeThis").hideToggle(); 
    $("#postSingle").hideToggle(); 
    }); 
    }); 
    $("#postSingle").fadeToggle(); 
    return false; 
}); 
}); 
+0

이전 답변보기 나는 그랬다. 아무 반응이 없습니다. –

+0

그는 페이지로드가 아닌 $ .load()에 대해 이야기하고 있습니다. –

관련 문제