24 July 2021

Javascrip Fetch example console

 


Fetch example

2021
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic bWljcm9zaXRlOlhhWkxwd1dieER4eW00N1Y=");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "Username": "phongph",
  "Subject": "subject test",
  "Body": "body test",
  "ActionId": "9618",
  "KeyValue": "ycmh",
  "SystemId": 34002
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("http://demo:88/api/notification/create", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

0 nhận xét:

Post a Comment

 

BACK TO TOP

Xuống cuối trang