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

182
Vistas
Is there any way to make JavaScript (client-side) variables viewable or retrievable outside client side? If so, how?

I'm new to web development. Recently I created a basic "chatbot" for a friend of mine to use, but I am having trouble trying to implement a method for me to save what they enter as input. I would like to view what they enter into the chatbot, but cannot because JavaScript is at client-side, whereas I need to pass the values over some server (I am guessing) so that I may view what type of inputs they enter into the chatbot.

I have looked into several solutions, but I have had no luck trying them. For example, although I have never worked with either of these before, I just recently attempted to use the following php:

$to = "some-email@gmail.com";

$subject = "New Chatbot Query";

$message = file_get_contents("php://input");

mail($to, $subject, $message);

and AJAX:

 function sendPHP(input, output){
    const jsonString = JSON.stringify(input, output);
    const xhr = new XMLHttpRequest();
    console.log(jsonString);
    xhr.open("POST", "receive.php");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.send(jsonString);
  }

in order to attempt to get an email from upon every input submission. Upon testing in LiveServer, the following error is shown in console: "Failed to load resource: the server responded with a status of 405 (Method Not Allowed)"

I would like to achieve a simple method to be able to read the input they put in the site, however currently I am having lots of trouble understanding servers/data base or how any of this works. I've tried looking up tutorials on AJAX, php, and more but I feel like there should be a simple way I just do not know of.

It should be noted, in HTML, the input field is NOT under a form. Which may have proved useful as my site is currently hosted on Netlify. However, doing so would cause the webpage to refresh upon any entered user-input and render the chatbot useless.

about 4 years ago · Juan Pablo Isaza
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