Test name | Executions per second |
---|---|
ajax | 2866.6 Ops/sec |
fetch | 5306.2 Ops/sec |
<script src='https://code.jquery.com/jquery-3.6.0.min.js'></script>
function showResult(data) {
console.log(data);
}
var newUrl = "https://www.googleapis.com/discovery/v1/apis";
var request = $.ajax({
type: "GET",
url: newUrl,
success: showResult,
data: null
});
fetch(newUrl)
.then(
function(response) {
response.json().then(function(data) {
showResult(data);
});
}
)
.catch(function(err) {
console.log('Fetch Error :-S', err);
});