Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

194
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda