fetch()

by Marcos vini

JavaScript

fetch('http://ws.correios.com.br/calculador/calcprecoprazo.asmx/CalcPrazo?nCdServico=04014&sCepOrigem=35774000&sCepDestino=65000600',{
      method: 'GET',
      mode: 'no-cors',
         headers: {
        'Access-Control-Allow-Origin': '*',
        'Content-Type': 'application/json'
      }
    })
  .then(response => response.text())
  .then(str => (new window.DOMParser()).parseFromString(str, "text/xml"))
  .then(data => console.log(data));