selvi jp

selvi jp

  • NA
  • 323
  • 77.3k

How can i pass id in post method react js

Oct 1 2021 6:09 AM

Hi,

I want to pass id in post method

handleSubmit(event) {

  event.preventDefault();

 

  const data = new FormData(event.target);

   const accessToken=user;

  

  fetch(url, {

    method: 'POST',

    headers:{

 

      Accept: 'application/json',             

        Authorization: "Bearer " +accessToken 

         

    },

    body: data,

  });

 

 }

<form method="post" onSubmit={this.handleSubmit.bind(this)} ></form>

Here i can post but after post i want push other page "sharepost/item.uploadid"

But i can achieve any one of this.if i post i cant push to other page.if i push i cant post.


Answers (2)