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

120
Views
Envía el objeto Json y recibe la respuesta al mismo tiempo

Para un proyecto escolar, debo enviar JSON. El servidor procesa este archivo y me envía una respuesta con un JSON. Todo debería suceder con JavaScript. Ahora me he dado cuenta de XMLHttpRequest , pero no lo entiendo del todo.

¿Tengo que crear dos objetos con GET y POST o es posible combinarlos?

Por el momento tengo una var httpPost = new XMLHttpRequest(); para enviar y uno para recibir var httpGet = new XMLHttpRequest();

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

hagámoslo con jQuery AJAX api:

 let json = {"key":"val"} $.post("api.php",json, function(response){ console.log(response) });

hagámoslo con Fetch api:

 const data = { username: 'example' }; fetch('api.php', { method: 'POST', body: JSON.stringify(data) }) .then(response => { console.log('Success:', response); })
about 4 years ago · Santiago Trujillo 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!