Guest User

Untitled

a guest
Nov 21st, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. @Autowired
  2. private CredentialDao credentialDao;
  3. @RequestMapping(value = "/fisicHost/{id}/credentials", method = RequestMethod.POST)
  4. public String deleteCredential(@PathVariable(value = "id") String credId){
  5. String[] parts = credId.split("-");
  6. int id = Integer.parseInt(parts[1]);
  7. Credential c = credentialDao.getCredentialById(id);
  8. credentialDao.delete(c);
  9. return "justreturnsomething";
  10. }
  11.  
  12. @Override
  13. public void delete(Credential credential) {
  14. Session session = sessionFactory.openSession();
  15. session.delete(credential);
  16. session.close();
  17. }
  18.  
  19. $("#credentialsTable").on('click',"button[id^='del-']", (e) => {
  20. var credentialId = e.target.id;
  21. console.log('credId' + credentialId);
  22. $.post( "/fisicHost/" + credentialId + "/credentials", data => {
  23. console.log(data);
  24. });
  25. });
Add Comment
Please, Sign In to add comment