html - Javascript/TVML use Variable from other File? -


i have tvos application based on js , tvml(similar html).

right have hardcoded in application.js. i've got loop, fills string json file, , below variable creates tvml template section calls filled variable.

var pictures =""; for(i = 0; < result.response.length; i++) {   pictures += '<lockup><img src="' + pictureurl + result.response[i].picture + '" width="1280" height="980"/></lockup>'; }  var template = `   <?xml version="1.0" encoding="utf-8" ?>   <document>     <showcasetemplate mode="showcase">       <background>         <img src="" />       </background>       <banner style="tv-position: center; tv-align: center">         <row style="tv-align: center">           <title ></title>         </row>            <row></row>       </banner>       <carousel>         <section>` + pictures + `</section>       </carousel>     </showcasetemplate>   </document> `; 

so want is, having 1 external javascript file, contains loops, since having lot of them. further, want have 1 xml file, contains layout of template, call variables loops, , call template in application.js.

how can that? possible call variable javascript in xml , call xml in javascript?


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -