I stumbled upon Fetch API today. It’s this simple:
fetch(url) .then((resp) => resp.json()) // Transform the response object into json .then(function(data) { // Do what the hell I want to do with received JSON data }) }) |
Seriously! I must have been living on Mars to have not noticed it earlier. XMLHttpRequest and jQuery.ajax — time to move on, ba bye!