From 7cb9e9601613099598142f71f6dc68513b0cf2a5 Mon Sep 17 00:00:00 2001 From: chikkibum Date: Mon, 17 Apr 2023 22:12:31 +0530 Subject: [PATCH] git_user_finder --- bhaskar/index.html | 48 ++++++++++++++++++++++++++++++++++++++++++++++ bhaskar/script.js | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 bhaskar/index.html create mode 100644 bhaskar/script.js diff --git a/bhaskar/index.html b/bhaskar/index.html new file mode 100644 index 0000000..98000ac --- /dev/null +++ b/bhaskar/index.html @@ -0,0 +1,48 @@ + + + + + + + Github_user_finder + + + + + + + + +
+ +

+

+ (❁´◡`❁)GitHub_User_finder(❁´◡`❁) +

+

+
+
+ +
+
+
+ +
+
+
+ (●'◡'●) Use this to find any user with their Username (●'◡'●) +
+
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/bhaskar/script.js b/bhaskar/script.js new file mode 100644 index 0000000..f16687b --- /dev/null +++ b/bhaskar/script.js @@ -0,0 +1,34 @@ + +//to display text after click on search! +function functionName() { + document.querySelector(".box").classList.toggle("b1") + } + + //fetch data from form! + var form = document.getElementById("myForm"); + + + form.addEventListener('submit', function (e) { + + //prevent the auto submission of form + e.preventDefault(); + + var search = document.getElementById("search").value; + + //to remove space in b/w firstName & lastName + var originalName = search.split(' ').join(''); + + document.getElementById("result").innerHTML = ''; + + fetch("https://api.github.com/users/" + originalName) + .then((result) => result.json()) + .then((data) => { + console.log(data) + + document.getElementById("result").classList.add("discription"); + + document.getElementById("result").innerHTML = ` + + ` + }) + }) \ No newline at end of file