mardi 23 mai 2017

How to do ajax delete on react

I was wondering if delete works like add but it doesn't. Im using fetch method Im not familiar on react's ajax so I am not clearly sure whats wrong with my code

so here is my code onclick delete

deleteEmployee(id) {
  jQuery.support.cors = true;
    fetch('http://localhost:5118/api/employeedetails/DeleteEmployeeDetail/'+ id, {
         method: 'GET'
  }).then(function(response) {
     // history.go(0);
      var jsonReturnedValue = [...this.state.jsonReturnedValue]; 
      this.setState({jsonReturnedValue})
  }).catch(function(err) {
    // Error :(
  });
}




Aucun commentaire:

Enregistrer un commentaire