Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

229
Vistas
How to save click path as JSON?

Let's say I have a quiz written in JavaScript. There are four different possible answers to each question. The participant clicks his way through the quiz one by one, he can cancel it at any time.

Now I want to save the user's click path including the respective timestamps. My idea is to record the click path as a JavaScript object and to transfer this object to the server via AJAX and save it in a JSON file after each click. Does that make sense?

The tricky things seem to me to be (1) to update the correct object (the correct line(s) in the JSON file) within a quiz session (no session cookies) for each click from the second click and (2) to append a new object for a new quiz session, both, if possible, without reading and rewriting the entire JSON file every time.

Your opinions and ideas are appreciated.

Edit: I have control over the backend and I'm using PHP.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Now I want to save the user's click path including the respective timestamps. My idea is to record the click path as a JavaScript object and to transfer this object to the server via AJAX and save it in a JSON file after each click.

Rather than sending the object to the server via Ajax and saving it in a .json file, you can, more simply, store a JSON (including timestamps) in localStorage and update it there.

See the localStorage API:

  • https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage

localStorage is both:

  • more robust / persistent than keeping the data in an object
  • less elaborate than Ajax-ing data to the server repeatedly
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda