Jump to content

Call a file and loop a JS array in side it?


EchoFool

Recommended Posts

My interpretations:

A. You are wanting to use an html file as a template for inserting data into and then attaching into your current web page.

B. You are wanting to read an html file and extract data from it.

 

For A, have a look at JavaScript templating libraries such as Handlebars.js {http://handlebarsjs.com/} or Moustache.js {https://github.com/janl/mustache.js}.

 

For B, you could create an html entity that isn't attached to the dom.  Load the html file via ajax, and use the file contents as the entity's inner-html.  Then traverse the entity's children to extract the data required.

 

Regards,

Liam Goodacre

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.