For a project in my uni, I wanted to build a website that contained 200 messages and make it so that users can modify those messages, and then any other user who looks at the site would be able to see the modified messages and modify messages themselves. There would be exactly 200 messages, and the only way to make a new one is to override an existing one.
I've got all the user interface stuff functional and I've been tinkering with using the Google Sheets API to accomplish the string storage since it will handle JS arrays, but it doesn't seem to really be built for this type of use case.
If it would be possible to store the messages as strings (maybe in an array) in a document on the server and be able to use the javascript to make permanent adjustments to the strings in that document it would be amazing but I can't seem to find any sort of documentation on how to do something like that. Does anyone know of any methods to approach a problem like this using JS and Jquery? Or know of an API they can recommend would be amazing.
Basically what I have already is a system that would call up the complete list of messages and store that as an array of strings.
var messagesIndex = (some sort of get function);
Then the user can select a message, and modify it, at which point the locally stored array is updated. active = "(this is just here to make it a global var, it's just an index of which message I want from the array of messages)"
$(function() { $("button").click(function() {
active = this.id;
update();
});
});
function update(){
//sets the message inside the message display box to the correct message, where it can be altered
$("#message").messagesIndex[active]);
//some other stuff here that isnt relevent to this question.
}
and then the java would send that updated set of strings which would permanently override it in that storage doc. At least that would be my ideal situation.