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

203
Vistas
Can I send a post request to a js file instead of php?

First of all I don't want to interact with the server in this transaction. I'm using the fetch api to send a request but in url I want to pass a js file. Something like this-

fetch("includes/handlers/handle.js", {
  method: "POST",
  headers: h,
  body: body
});

Also if it's possible can we be getting the POST variables using JS only?

I know this might seem like it doesn't make any sense to do it this way. But I'm trying something and would really appreciate any help.

about 4 years ago · Santiago Gelvez
2 Respuestas
Responde la pregunta

0

You can make a POST request to any URL you like.

You can't avoid interacting with the server when making requests to HTTP URLs. (And only HTTP URLs support POST requests).

It is up to the server to process that request.

You can write server-side code using JavaScript with tools like Node.js or Deno (Node.js being the most common approach).

Typically, when you do so, URLs where POST request bodies will be processed will not have .js in the URL - that is normally only used to serve static files to the client.


You cannot read the body of a POST request with client-side JS.

about 4 years ago · Santiago Gelvez Denunciar

0

It's quite odd, but I do think it's possible. You should remove any static serving for .js files on your server, and differentiate between static client side js files & http request handlers.

about 4 years ago · Santiago Gelvez 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