亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - How to pass data to ejs template in ajax request?
僅有的幸福
僅有的幸福 2017-05-18 10:47:54
0
1
646

The front end uses gulp to compile the ejs template into html. When actually using it, how does the data returned by the ajax request from the background be passed to the ejs template?

Generally, the template transfers data by first obtaining the template and then filling in the value. The data returned by the ajax request is in *.ejsHow to transfer the data to the template?

          var data = [{
                       "name":"張三",
                       "info":[
                         "眼睛",
                         "耳朵",
                         "鼻子"
                       ]
                     }];

       //獲取模版
       var myTemplate = Handlebars.compile($("#table-template").html());
        
       //將json對象用剛剛注冊的Handlebars模版封裝,得到最終的html,插入到基礎table中。
       $('#dataList').html(myTemplate(data));
僅有的幸福
僅有的幸福

reply all(1)
為情所困

You can consider using underscore

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template