1

When I use axios with SharePoint, it successfully works in Chrome but not in IE 11. The error is 'Promise' is undefined. Using the polyfill does not work either. Any ideas? Code below:

window.onload = function(){
  var endPointUrl = _spPageContextInfo.webAbsoluteUrl + 
"/_api/web/lists/getbyTitle('staffing')/items";
  axios.get(endPointUrl).then(function(response){
      console.log(response.data);
  })
}

These are the libraries I use

<script src="https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.min.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script type="text/javascript" src="https://afhq.egovservices.net/sites/Isaac/Webparts/staffing/staffing.js"></script>
3

To make it work you should reference "auto" version of es6-polyfill:

<script src="https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.js"></script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.