jwoff
jwoff

Reputation: 165

How to approach accessing large amounts of data using javascript

I'm working on a personal web project to create a practice test website for students at my university. I have a list of a bunch of words (100+) with their definitions, word families and whatnot. Currently I have the entire list copy and pasted directly into the javascript code (I know, I'm so sorry) but this is gross and I'm looking for a more elegant solution.

Can I draw the data from a text file, or perhaps a database using javascript? I'm rather new to web development (in terms of structure) and was wondering if I could get some direction. I am using CPanel currently running on my school's server with my student account. I have access to MySQL databases and the whole suite of tools.

Thank you!

Upvotes: 0

Views: 101

Answers (1)

Behram Buhariwala
Behram Buhariwala

Reputation: 103

It all depends on the size of this words object. If your list of words is not that heavy, you can simply store in a JSON file. This would a very raw solution. Or you can create tables in MySQL and use a suitable programming language like Java Python etc to interface with the database and send the response ahead. If you have a lot of data and a lot of operations under the hood on that data, I would suggest you optimize your approach and get data in Chunks using AJAX.

Another approach is store a certain amount of data in a Web worker so you can provide a chunk of that data directly from there avoiding a network call. Either way its the same thing.Fetch new data as and when required and store it in your web worker by clearing the previous stale data.

Upvotes: 1

Related Questions