I'm looking to rewrite a jQuery ajaxSetup function in vanilla JavaScript that will work across all browsers.
Essentially, I want the same functionality of presetting data for all future AJAX calls using jQuery, but written in pure JavaScript.
const xhr = new XMLHttpRequest();
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.setRequestHeader('_token', ajax_token);
So, I need this setup to be done in vanilla JavaScript, but will still be utilizing jQuery ajax for the rest of my code. Any suggestions on how to achieve this? Thank you!