2013-05-01 67 views
0

我想將一個局部視圖加載到一個彈出對話框上。在彈出對話框上渲染局部頁面

我已經創建了工作對話框的代碼。我想知道我怎麼能夠加載這個局部視圖到對話框,雖然鏈接點擊所有的代碼是提供下面關於鏈接,java script and popup dialog box

HTML代碼:

<div id="mediaContainer" class="jqmDialog" style= "width:750px; left:23%; top:18%; height:525px; "> 
    <div class="jqmnTitle jqDrag"> 
    <h1>Subscriptions</h1>  
    </div> 
    <img class="jqmClose" style="position: absolute; cursor: pointer; right: 2px; top: 2px;" onclick="closeDialog();" src="@VirtualPathUtility.ToAbsolute("~/Content/images/close.gif")" 
      alt="Close" height="20px" width="20px" /> 

     <center> 
     <div id="divpart"></div> 

     </center> 
</div> 

JAVA腳本:

function renderPart(element, templateId) { 
     makeDialogBox(); 
jQuery.get(FBUrl, { id: templateId }, function (data) { 
       // alert(data); 
       $("divpart").append(data); 
     }); 

    } 

超鏈接:

<a href="#" style="text-decoration: underline;" class = "lnkShowMarketRates" onclick="renderPart(this.id, @item.id);">Subscriptions</a> 

回答

0

充分利用XMLHttpReq使用原生javascript或jquery將其添加到部分視圖的URL中,並將輸出附加到模態對話框中的某個div上。我使用jQuery的

  function renderPart(element, templateId){ 
      $.ajax({ 
      url : '', 
      type : 'GET', 
      succsess : function(response) 
      { $("#divIDinsideModalBox").html(response); makeDialogBox(); } 
      }); 
     } 
+0

ü可以給我請 – user2306809 2013-05-01 09:12:07

+0

@ user2306809更新我的代碼用一個例子,包裹裏面的功能Ajax調用並調用鏈接 – Devesh 2013-05-01 09:15:26

+0

的點擊我已經更新了功能是什麼我已經嘗試過,仍然沒有工作 – user2306809 2013-05-01 09:21:18

0
jQuery.get("InsertURLHere", { id: templateId }, function (data) { 
       // alert(data); 
       $("divpart").append(data); 
     }); 
相關問題