1. 程式人生 > >fetch請求

fetch請求

method body pre app new function clas www blog

fetch post傳參

  let formData = new FormData();

  formData.append(‘grant_type‘, ‘client_credentials‘);
  formData.append(‘client_id‘, ‘game-client‘);
  formData.append(‘client_secret‘, ‘0a0e2b7c0f223ff235810cbdc70f1d97‘);
  formData.append(‘scope‘, ‘game_client‘);

  fetch(‘http://www.math80.com/token‘,{method: "POST",body:formData})
  .then(function(response) {
      console.log(response)
  })
  .catch(function(){
    console.log(‘1232222‘)
  });

  

fetch請求