Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

send get request with button to endpoint

form.addEventListener('submit', (event) => {
  event.preventDefault(); //stop reload

  let input = document.querySelector('input');

  let method = 'GET';
  let endpoint = `request url ${input.value}`;

  xhr.open(method, endpoint);
  xhr.send(); //if in the link what you looking for this send will be empty!!!
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #send #request #button #endpoint
ADD COMMENT
Topic
Name
1+7 =