2012-03-19 2 views
1

사이트가 있습니다 lots of products here새 페이지를로드하는 대신 대화 상자에 세부 정보를 표시하려면 어떻게해야합니까?

각 제품마다 product details 링크를 클릭하면 현재 다른 페이지로 이동합니다. 나는 현재 페이지의 팝업/대화 상자에 그 세부 정보를 원합니다.

이 방법을 제안 해주세요.

$('.class for links').click(function(e) { 
    var url = this.href; // get the current href 
    var dialog = $("#dialog"); 
    if ($("#dialog").length == 0) { // create dialog if it doesnt already exist 
     dialog = $('<div id="dialog" style="display:hidden"></div>').appendTo('body'); 
    } 

    // load remote content 
    dialog.load(
     url, 
     {}, 
     function(responseText, textStatus, XMLHttpRequest) { 
      dialog.dialog(); // show the dialog 
     } 
    ); 
    //prevent the browser following the link 
    e.preventDefault(); 
}); 

참고 콘텐츠를하기 위해 사용되는 URL 그냥 대화의 내용이 아니라 전체 페이지

를 반환해야 함 : 나는

답변

관련 문제