What is the best way to utilize an HTML form input in order to update a value on a website that will affect all users?

I am relatively new to web development and I am currently working on a website that features a leaderboard. The goal is to allow users to input the number of points they have earned since their last log-in, with this value being added to their existing score, and have the leaderboard update accordingly.

While I already have the leaderboard in place and functioning smoothly, complete with point values as predefined variables within the code, I am facing a challenge when it comes to integrating user inputs into the system. I am struggling to figure out how to dynamically update the user's point total based on their input, ensuring that the change reflects not only on their end but also for all other users once they refresh the page.

At present, the log form resides on a separate .html subpage compared to the leaderboard, but shares the same .js file. I am open to relocating the log form to a modal pop-up on the main page if necessary.

I briefly explored PHP as a solution, but unfortunately, my hosting platform (Neocities) does not support PHP.

My initial attempt involved using the following snippet:

pointValue = pointValue + inputtedValue;
However, this did not lead to the desired outcome of updating the main page...

I have researched similar queries on Stack Overflow, and one suggestion that stood out recommended storing the value in the computer's memory to retain it even after refreshing or closing the browser. Nevertheless, I'm unsure how this method would facilitate an updated value visible to users accessing the site from different devices.

Answer №1

If you want to update data for all users, the changes must be made on the server side.

This task typically involves implementing server-side programming in some capacity.

Regrettably, Neocities does not endorse any form of server-side programming.

To accomplish this goal, consider switching your hosting provider (or utilizing multiple hosting services, such as having a web server with server-side programming capabilities deliver the data and access it using Ajax).

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Style binding for background image can utilize computed properties or data for dynamic rendering

In my code, I am trying to pass an object that contains a string path for its background image. I have experimented with using data and computed properties, but so far I haven't had any luck getting them to work within the :style binding. However, if ...

React Full Calendar Error: Unable to access property 'calendar' from undefined

I'm encountering an issue while attempting to save selected time information in state. Any assistance would be greatly appreciated, thank you for your help! Please feel free to ask if more specific details are required. Below is a snippet of code fro ...

Angular Material's Expansion Panel Alignment

I am currently facing an issue with aligning the icon to the left side of the expansion panel and centering the title. I've tried using CSS with text-align but it's not working as expected. Any advice or suggestions would be greatly appreciated, ...

Tips for integrating Series data into Highcharts using MVC

Looking at this JFiddle demonstration of Highcharts http://jsfiddle.net/yxz80f4u/9/ We can observe the data being inserted as [Date.UTC(YYYY,MM,DD,HH,MM,SS), Y-data-point] data: [ [Date.UTC(1970, 7, 5,1,1,1), 2.22], [Date.UTC(1 ...

problem with overflow in HTML and CSS opera browser

My gradient is not displaying properly in the Opera browser. Can anyone help me troubleshoot? Check out the code on jsfiddle for reference:) http://jsfiddle.net/KtDTK/7/ <div class="product_1"> <div class="product_block"> <div cla ...

To what extent can we anticipate the behavior of the event loop in Node.JS?

When dealing with simple client-side JavaScript code like this example, the behavior of setTimeout is based on the time interval specified (in this case, 0ms), which determines when the JS runtime adds it to the queue as explained here. In Node.JS, things ...

The Bootstrap Modal consistently displays the initial record, regardless of the row that is selected

I'm having an issue with a table that displays records and two buttons for edit and delete. When I click on the buttons, a Bootstrap modal opens, but it always displays the first record regardless of which row is clicked. <!DOCTYPE html> <htm ...

Why does the Select2 Drop down eliminate the mandatory border color?

Within my application, I have implemented a feature where required fields are designated with a red border. To achieve this effect, I utilized the following CSS code: input[data-val-required], select[data-val-required] { border: 1px solid #EFA4A4 !imp ...

The object THREE.DRACOLoader does not have a constructible function

When importing the three js and draco modules as shown below: import * as THREE from 'https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e7938f958282a7d7c9d6d5d6c9d6">[email protected]</ ...

Connect the checkbox value to the parent component using the control value accessor

Starting my journey with Angular, I encountered a challenge with forms. In a complex form structure, I opted to create a separate component for input and validation handling. This is how a table row looks like: <tr app-table-row-i ...

NodeJS Jest test failing due to a global variable being set for a different test already

I am currently working on a project in TypeScript using Node.js and Jest. I have a function that may or may not modify a global variable, which is a TypeScript Map. After one test modifies the global variable, it retains that value for subsequent tests. I ...

My pen doesn't accurately display the ID

CHALLENGE var shoppingCenters = [{ id: 0, name: 'Leclerc', location: 'Paris,France', address:'Boulevard Rahal El Meskini Casablanca Maroc', ] }, { /*Malls B*/ id: 1, name: 'Carefour', location ...

Leveraging the spread operator for setting state in a series of consecutive updates

Within my component, I am retrieving values from local storage and attempting to load them into the state when the component mounts. However, only the last property that I add seems to be included in the state. I have confirmed that all values are present ...

What is the best way to nest a div within a flexbox container?

I am attempting to create a div that is based on percentages, and I want to nest a div inside another. Specifically, I want the center (xyz div) to only take up 90% of the height of the content-div. My goal is for the "content" div to be responsive to 90% ...

JQuery is failing to locate elements that have dynamic data titles assigned to them

I've been attempting to locate an element using a jQuery regex comparison in the data title. My situation involves having divs with the class .textbox, each containing a dynamically generated data title. To target specific boxes with that particular d ...

What is the best approach for implementing a CSS reset across multiple websites with different content?

As I work on a page that will be displayed across numerous websites beyond my control, shown within a jQuery UI dialog window using $.load(), the content is vulnerable to the CSS directives set by each individual site. To prevent conflicts, I have made sur ...

Could you please suggest a method to position a button that is not entirely on the right side?

As I work on building my website, I am faced with the challenge of aligning a button directly under an image. I have utilized HTML tags and assigned a class to it for CSS styling purposes. However, when it comes to setting the alignment using the 'tex ...

The use of scaffolding and grid structures within the Twitter Bootstrap framework

I'm currently utilizing the bootstrap scaffolding/grid system in the following manner: <div class="row-fluid"> <div id="insta-shop-filter" class="span2 visible-desktop"> </div> <div id="insta-shop-grid" class="span1 ...

Retrieving the data-id attribute from dynamically rendered div elements

How can I modify my checkPair function to retrieve the data-id attribute when clicking on a dynamically created card? Currently, I am encountering an error stating "The name 'getAttribute' could not be found." function createHTMLElementFromHtml( ...

The function in JavaScript designed to load images before they are displayed is not functioning properly

Inside a custom object constructor, there is a method known as addToViewport(), which serves the purpose of displaying an image after it has been preloaded: window.onload = function(){ function ViewportObject(){ this.src = "ht ...