Skip to content

Commit

Permalink
Merge pull request Women-Coding-Community#176 from dricazenck/example…
Browse files Browse the repository at this point in the history
…_api

test: testing api request
  • Loading branch information
womencodingcommunity authored May 4, 2024
2 parents 3a0e86e + f2d782a commit cb9bc17
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 cb9bc17

Please sign in to comment.