Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

552
Views
POST 405 (método no permitido) con XMLHTTPRequest

He estado recibiendo este error durante bastante tiempo y me está volviendo loco. Me gustaría enviar una solicitud POST a un archivo PHP con ajax usando XMLHTTPRequest(). Este es el error que me sale: Consola Edge

Aquí está mi código Javascript:

 function sendAndReceive(string, user) { let http = new XMLHttpRequest(); let url = "http://127.0.0.1:5500/forum/js/forum.php"; let message = "message=" + string; let username = "&user=" + user; let sendString = message + username; http.open("POST", url, true); http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("testAJAX").innerHTML = this.responseText; } }; console.log(sendString); http.send(sendString); document.getElementById("testAJAX").innerHTML = "Loading..."; }

Soy bastante nuevo en Javascript, por lo que el error puede ser trivial. También uso Visual Studio Code Live Server para omitir los errores de tipo de política CORS, podría tener que ver con esto. También he visto muchas respuestas que apuntan hacia jQuery, sin embargo, esto es para un proyecto escolar y no puedo usarlo.

Gracias a cualquiera que responda.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!