-1

我有这个:

$("#OpenMap").click(function(){
    $.ajax({
        type: "GET",
        url: "_Ajax.AdQuestions.php",
        data: "OpenMapID=<?php echo $_SESSION[SESSION_ADS_ID]; ?>",
        success: function(data){ $("#OpenMap").html(data); }    
    });
});

所以现在hte地图将显示在<div id="">#OpenMap</div> 我如何才能意识到我的地图将在fancybox中打开它?例如。像这样?

$("#OpenMap").click(function(){
    $.ajax({
        type: "GET",
        url: "_Ajax.AdQuestions.php",
        data: "OpenMapID=<?php echo $_SESSION[SESSION_ADS_ID]; ?>",
        success: function(data){ $(".fancybox").fancybox(data); }   
    });
});
4

1 回答 1

1

尝试

$("#OpenMap").click(function(){
    $.ajax({
        type: "GET",
        url: "_Ajax.AdQuestions.php",
        data: "OpenMapID=<?php echo $_SESSION[SESSION_ADS_ID]; ?>",
        success: function(data){ 
         $.fancybox(data,{
          // fancybox API options here
         }); 
        }   
    });
});

假设您的 html 中有某处

<a id="OpenMap" href="javascript:;">open map</a>
于 2012-05-17T18:51:39.523 回答