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

134
Views
How can I change this with a conditional variable?

My question is can I change this code using variables and use conditionals and how can I do it? My problem is The Validation I need that it is only necessary to fill in only one piece of information and it is not necessary to fill out the entire form

 <script>

   function save_producto(){
   let fd=new FormData();

these are the values I want to pass to variables

    fd.append('arriba',document.getElementById('arriba').value);
    fd.append('abajo',document.getElementById('abajo').value);
    fd.append('imagen',document.getElementById('imagen').files[0]);

   

This the part show the errors

 
    request.open('POST','api/producto_save.php',true);
      request.onload=function(){
        if (request.readyState== 4 && request.status== 200) {
        let response= JSON.parse(request.responseText);
        console.log(response);

          if(response.state){
          alert("correcto");
          }else{
          alert(response.detail);
  }

  
}
}

send everything

request.send(fd);

}
</script>
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!