2014-04-25 67 views
0

嗨,我有這樣的div。如何在jquery中設置模板

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> 

<div id="PDialog"> 
       <div id="PDialogPlaceHolder"> 
       </div> 
      </div> 

現在我想設置的模板在這個dialig,我做這樣的

$("#PDialog").dialog(
       { 
        bgiframe: true, 
        autoOpen: false, 
        height: 825, 
        width: 850, 
        position: 'top', 
        modal: true, 
        draggable: true, 
        title: Details', 
        open: function() { 
         // call ajax function to load the special quotes 
         InitpDialog(id); 
        }, 
        close: function() { 

        } 
       }); 


function InitpreviewDialog(SRNumber) { 

    $.ajax({ 
     url: '/Getdetail/GetPDetails', 
       contentType: "application/json; charset=utf-8", 
       data: { 'ID': id }, 
       type: 'GET', 
       cache: false, 
       success: function (result) { 

        var placeHolder = $("#PreviewDialogPlaceHolder"); 

        placeHolder.setTemplateURL("/Templates/cabPreviewDetails.htm"); 


        placeHolder.processTemplate(result); 
       } 
      }); 

我越來越不支持的對象錯誤,哪裏是錯誤的。

+1

小心打開/關閉引號:'title:Details','應該是'title:'Details',' –

+0

Where?我沒有得到你。請告訴我 – Naruto

回答

1

這INIT:

$("#PDialog").dialog(
{ 
    bgiframe: true, 
    autoOpen: false, 
    height: 825, 
    width: 850, 
    position: 'top', 
    modal: true, 
    draggable: true, 
    title: Details', 
    open: function() { 
     // call ajax function to load the special quotes 
     InitpDialog(id); 
    }, 
    close: function() { 

    } 
}); 

應該變成:

$("#PDialog").dialog(
{ 
    bgiframe: true, 
    autoOpen: false, 
    height: 825, 
    width: 850, 
    position: 'top', 
    modal: true, 
    draggable: true, 
    title: 'Details', // SEE THE OPENING QUOTE ADDED ON THIS LINE 
    open: function() { 
     // call ajax function to load the special quotes 
     InitpDialog(id); 
    }, 
    close: function() { 

    } 
}); 

但我不知道,如果這是你的問題的原因。至少,肯定是一個錯字。在這裏添加,而不是在評論中原因是太多的文字粘貼。