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

177
Views
¿Cómo se obtienen los datos del formulario para enviar usando AJAX?

Estoy tratando de obtener un formulario para enviar. Estoy usando HTML, JS, PHP y AJAX aquí. Dado que no se enviará, supongo que algo está mal con mi función de inserción, sin embargo, no puedo averiguar cuál es el problema. Cada vez que hago clic en "enviar" nada cambia. Nada se mueve. La información no se agrega.

 <!doctype html> <html> <head> <script src="./js/jquery-3.6.0.min.js">.
 </head> <body> <form onsubmit="return(insertPeople())"> First name: <input type=text id=firstname><br> Last name: <input type=text id=lastname><br> Phone number: <input type=text id=telephonenumber><br> <input type=submit value=submit> </form> <div id=showpeople></div> <script> function insertPeople(){ val = $("#showpeople").val(); $.get("./week7ajax.php",{"cmd":"create", "firstname,lastname,telephonenumber" : val}, function(data){ $("#showpeople").html(data); }); return(false); } function showpeople(){ $.get("./week7ajax.php",{"cmd":""}, function(data){ $("#showpeople").html(data); }); return(false); } showpeople(); </script> </body> </html>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Dale una oportunidad a esto. Arreglé algunas citas que faltaban, sangré algunas líneas y eliminé algunos códigos innecesarios.

 <form onsubmit="insertPeople(); return false;"> First name: <input type="text" id="firstname"><br> Last name: <input type="text" id="lastname"><br> Phone number: <input type="text" id="telephonenumber"><br> <input type="submit" value="submit"> </form> <div id="showpeople"></div> <script> function insertPeople() { val = $("#showpeople").val(); $.get("./week7ajax.php",{"cmd":"create", "firstname,lastname,telephonenumber" : val}, function(data){ $("#showpeople").html(data); }); } function showpeople() { $.get("./week7ajax.php",{"cmd":""}, function(data){ $("#showpeople").html(data); }); } showpeople(); </script>
about 4 years ago · Juan Pablo Isaza Report
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!