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

226
Views
How to access post variables fetched from javaScript's

I am trying to access post information in php file, but I clearly cannot find a way how to do it since I do not enter the if statement:

php code:

<?php

    if(isset($_POST["submit"])){
      var_dump($_POST);
     }
exit();

js code:

   const name = document.getElementById("name").value;
       

   const formData = new FormData();
   formData.set("name", name);
   formData.set("submit", "submit");

   fetch('./includes/index.inc.php', {  
      method: 'post',  
      body: formData
    })
    .then(function(res){ return res.text })
    .then(function(text){console.log(text)})
    .catch(function(res){ console.log(res) })

Does service worker play a role here?

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!