how do I let users of my website submit data to my website for all my users to see with just javascript [closed]

You cannot do this with just javascript. Here’s why.

Javascript runs on the client browser. Every visitor to your website will run javascript code on their own computer, with no communication with the server (except through AJAX, which sends data from javascript back to a server-side file and then (optionally) returns new data from the server to the javascript file) The point is, even AJAX uses server-side code.

Every new visitor views the website from the server. So, there must be a way for a user’s changes to be saved to the server so that they can be shown to new visitors.

We are back to server-side code as being the only way to accomplish what you desire. The two things you must research are HTML <form>s (which navigate away from (or refresh) the current page), and AJAX (which does neither).

A bit more information on AJAX

To store the information on the website so that new users can see it, you have two options: database (e.g. MySQL), or text file on the server. Your website code would then read from the database or file and incorporate that data into the website.

Browse More Popular Posts

Leave a Comment