2013-07-02 38 views
0

當我使用Mustache.to_html方法時,它返回空字符串(「」)。但是當我通過使用檢查點來調試代碼並向前移動時,我獲得了我的模板, 爲什麼我會得到這樣的行爲? 我的代碼是這樣的 -Mustache.to_html方法returing me empty String(「」)?

var temp = $.get(/templates/mytemplate); 
    var data = { 
       name : "john", 
    }; 
    var html = Mustache.to_html(temp,date); 

我越來越html作爲""但通過使用breakpoing我得到正確的HTML。爲什麼?

+0

貌似這個問題http://stackoverflow.com/questions/14220321/how-to-return-the-response-from-an -ajax-call,你似乎也缺少引號...... – elclanrs

回答

0
var temp = $.get(/templates/mytemplate); 
    var data = { 
       name : "john", 
    }; 
var html = Mustache.to_html(temp,data); 

有拼寫錯誤,如日期,而不是數據..