Skip to content

Commit

Permalink
testing api request
Browse files Browse the repository at this point in the history
  • Loading branch information
dricazenck committed May 4, 2024
1 parent 3a0e86e commit f2d782a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions _includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ <h2>Follow Us</h2>
<script src="/assets/js/navbar.js" type="module"></script>
<script src="/assets/js/mentors.js" type="module"></script>
<script src="/assets/js/search.js" type="module"></script>
<script src="/assets/js/api_request.js" type="module"></script>

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-3V6VPT445S"></script>
Expand Down
22 changes: 22 additions & 0 deletions assets/js/api_request.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
var ajaxController = (function(jQuery) {
const requestData = function() {
$.ajax({
url: "https://api.restful-api.dev/objects/7",
method: "GET",
success: function(response) {
console.log("GET request successful");
console.log(response);
},
error: function(xhr, status, error) {
console.error("Error making GET request:", status, error);
}
});
};

return {
init: requestData
};

}(jQuery));

ajaxController.init();

0 comments on commit f2d782a

Please sign in to comment.