Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0
Firefox 110
Windows
Desktop
one year ago
Test name Executions per second
ajax 2866.6 Ops/sec
fetch 5306.2 Ops/sec
HTML Preparation code:
AخA
 
1
<script src='https://code.jquery.com/jquery-3.6.0.min.js'></script>
Script Preparation code:
 
function showResult(data) {
    console.log(data);
}
var newUrl = "https://www.googleapis.com/discovery/v1/apis";
Tests:
  • ajax

     
    var request = $.ajax({
        type: "GET",
        url: newUrl,
        success: showResult,
        data: null
    });
  • fetch

     
    fetch(newUrl)
      .then(
        function(response) {
          response.json().then(function(data) {
            showResult(data);
          });
        }
      )
      .catch(function(err) {
        console.log('Fetch Error :-S', err);
      });