簡體   English   中英

如何在jQuery中設置模板

[英]How to set template in 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);
                }
            });

我收到對象不支持的錯誤,錯誤在哪里。

初始化:

$("#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 () {

    }
});

但是我不確定這是否是造成您問題的原因。 至少,肯定是錯字。 在此處添加且未添加注釋,原因是要粘貼太多文本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM