Created
December 28, 2020 08:43
-
-
Save MakkiAbid/8c34a5a2bcbd088a943c5f7ce2177086 to your computer and use it in GitHub Desktop.
// source https://jsbin.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<script src="https://code.jquery.com/jquery-3.1.0.js"></script> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<p id="data"></p> | |
<button id="btn">Send Request</button> | |
<script id="jsbin-javascript"> | |
$("#btn").on("click", function(){ | |
$.ajax({ | |
url: "https://api.envato.com/v1/market/total-items.json", | |
type: 'GET', | |
beforeSend: function(request){ | |
request.setRequestHeader("Authorization", "Bearer uUDtFb04bcyCdVTL2gXwpSZshHgxYa42"); | |
}, | |
success: function(data){ | |
console.log(data); | |
$("#data").html(data['total-items'].total_items); | |
} | |
}); | |
}); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">$("#btn").on("click", function(){ | |
$.ajax({ | |
url: "https://api.envato.com/v1/market/total-items.json", | |
type: 'GET', | |
beforeSend: function(request){ | |
request.setRequestHeader("Authorization", "Bearer uUDtFb04bcyCdVTL2gXwpSZshHgxYa42"); | |
}, | |
success: function(data){ | |
console.log(data); | |
$("#data").html(data['total-items'].total_items); | |
} | |
}); | |
});</script></body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#btn").on("click", function(){ | |
$.ajax({ | |
url: "https://api.envato.com/v1/market/total-items.json", | |
type: 'GET', | |
beforeSend: function(request){ | |
request.setRequestHeader("Authorization", "Bearer uUDtFb04bcyCdVTL2gXwpSZshHgxYa42"); | |
}, | |
success: function(data){ | |
console.log(data); | |
$("#data").html(data['total-items'].total_items); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment