matheusbergue

Untitled

Jan 20th, 2021
2,360
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var submit = document.getElementById('button')
  2. var form = document.getElementById('form')
  3.  
  4. var teste = {teste:'aaaaaa'}
  5.  
  6. form.onsubmit = function(e) {
  7.     e.preventDefault();
  8.  
  9.     const init = {
  10.         method: 'POST',
  11.         body: JSON.stringify(teste),
  12.         headers: {'Content-Type': 'application/json'}
  13.     }
  14.  
  15.    
  16.     fetch('http://127.0.0.1:8080/login', init)
  17.  
  18.  
  19. }
RAW Paste Data