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

299
Views
por que me da el error de que la clave 'val' no existe

Tengo un problema con una solicitud ajax, este es el script:

 async function http(data) { const objdt = { val: data } const response = await fetch("lib/bot.php", { method: "POST", hedaers: {"Content-type": "application/x-www-form-urlencoded; charset=UTF-8"}, body: JSON.stringify({objdt}) }) .then(response => response.text()) .then(data => inschat(data)) .catch(err => console.log(err)); } var inschat = (dt) => { alert(dt.data); } const inpChat = document.querySelector("input[name=chat_input_text]"); inpChat.addEventListener("keypress", (event) => { if(event.keyCode === 13 && inpChat.value !== ""){ let data = inpChat.value; http(data); } });

mientras que en php tengo esto, solo para probar:

 $dt = trim($_POST["val"]); echo $dt;

pero me da error Warining Undefined array 'val' ¿alguien puede ayudarme gracias estoy atascado

over 4 years ago · Santiago Trujillo
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!