3.2.0

add txt data into js function

Hi guys,

Im new to this and was hoping I could get some help with my new js store, is there a way to include data from a txt file during a function?

this is what I have and what i need
------------------------------------CURRENT SCRIPT-----------------------------

function store() {
this.products = [
{ num: 1, code: 'CAT', category: 'CAT1', name: 'PRODUCT 1', src: "1.png", description: 'Product 1 Information. ', price: 5.99, cal: 10 },
];

}


-------------------------------------WHAT I NEED------------------------------

function store() {
this.products = [
{Product1.txt},
];

}


or can I have a page that allows me to add a new line into the .js file? I just want to make it easier to load products into my page

Ryan C
June 2,
no idea how browser's JavaScript could read a text file from disk; all you can do is get it from the server using an AJAX request
November 28,

This topic is archived.


Back to support forum