2013-02-07 19 views
0

這是我試圖呈現的模板。Mustache.js在Android手機上渲染較小的模板時拋出錯誤

<div> 
    <div class="button"> 
     <a href="#/account" class="fill-div">View Balance</a> 
    </div> 
    <div class="button"> 
     <a href="#/transactions" class="fill-div">View Transaction History</a> 
    </div> 
</div> 

這沒有任何json組件。我的鬍鬚代碼渲染非常簡單。

function getTemplate(name) { 
    $.get("../templates/" + name, function (template) { 
     try { 
     html = Mustache.render(template, true); 
     $('#place_holder').html(html); 
     }catch(ex){ 
     alert(ex); 
     } 
    }); 
} 

此代碼在瀏覽器中工作得很好。但是當我使用phonegap進行打包時,當我嘗試在Android移動設備上運行它時,出現如下錯誤。

enter image description here

什麼任何暗示可能是錯的?如果您需要,歡迎提供更多細節。

回答

0

問題出在jQuery get請求。

$ .get正在模擬器和移動設備中返回一個對象[文檔]。因此,將「text」添加到$ .get,並解決了問題。

$.get("../templates/" + name, function (template) { 
     html = Mustache.render(template, true); 
     $('#place_holder').html(html); 
    }, "text");