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

67
Views
Javascript - Store the response of a POST request in a variable

I have been trying to store the result of a POST request into a variable. I am coding in Zapier

let numero= input_data["numero"]
let data = {element: numero, elemento: "www.link.it" }

fetch("url", {
  method: "POST",
  headers: {'Content-Type': 'application/json'}, 
  body: JSON.stringify(data)
})

.then(function(res) {
  return res.text();
})
.then(function(body) {
  console.log(body);
  var output = {rawHTML: body};
  callback(null, output);
})
.catch(callback);

Pretty new to this

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Not sure if this has much to do with Zapier. It is just orfdinary Javascript fetch api

But you could for example do something like this:

let responseBody;    
fetch("url", {
method: "POST",
headers: {'Content-Type': 'application/json'}, 
body: JSON.stringify(data)
})

.then(function(res) {
     responseBody = await res.text();
   })
  .then(function(body) {
        console.log(body);
        var output = {rawHTML: body};
        callback(null, output);
  })
    .catch(callback);
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!