2013-03-20 27 views
0

我得到一個引用jtemplates.js的「無效標籤」錯誤。如果我用processTemplate註釋掉它,它就會消失。我甚至可以在result.d上做一個警報。無效的標籤錯誤正在執行processTemplate for jTemplate

這裏是我的AJAX調用:

var data = { ID: @SessionVariables.ID }; 
    $.ajax({ 
     type: "POST", 
     url: "../Services/DataService.asmx/FetchProfitSummaryData", 
     data: JSON.stringify(data), 
     contentType: "application/json; charset=utf-8", 
     dataType: "json", 
     success: function (result, status) { 
      $('#rptProfitSummary').setTemplateURL('../Investment/JTemplates/TestListTemplate.htm'); 
      $('#rptProfitSummary').processTemplate(result.d); 
     }, 
     error: AjaxFailed 
    }); 

我的模板內容梗概:

<table> 
    <tr> 
     <td>JTemplate basic success!</td> 
    </tr> 
</table> 

它似乎並不涉及到JSON VS JSONP,或驗證問題,因爲我有在其他問題上看到。我也使用jquery 1.7,所以使用早於此版本的bug也不是問題。

有什麼想法嗎?

回答

0

事實證明,錯誤是誤導。它確實與任何標籤無關。我忽略的是模板的路徑不正確。取而代之的

'../Investment/JTemplates/TestListTemplate.htm' 

應該

'../JTemplates/TestListTemplate.htm'.