Jeremy
Jeremy

Reputation: 925

How to better store arrays of data for use in a JavaScript app

I have an interactive JavaScript app that runs through arrays of data. I don't want users to be able to easily view the array content, so I have stored the arrays in PHP and pass them to the JavaScript app with AJAX and JSON. I had thought about using a database, but since these files only have to read (not written) I thought it would be unnecessary.

Am I missing an obvious and easier way to do this? Perhaps some sort of server-side cache?

Cheers,

Upvotes: 0

Views: 68

Answers (1)

SpliFF
SpliFF

Reputation: 39014

You really shouldn't be using PHP to emit JSON arrays when you could just create static JSON files (like data.json) with the data already in JSON format.

Upvotes: 1

Related Questions