Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submitting Palindrome #221

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 12 additions & 0 deletions api.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="/css/style.css">
</head>
<body>
<h1>API Loading</h1>
<script type="text/javascript" src="/js/main.js"></script>
</body>
</html>
1 change: 1 addition & 0 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

5 changes: 5 additions & 0 deletions data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
name: "leon",
status: "Boss Man",
currentOccupation: "Baller"
}
19 changes: 19 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="/css/style.css">
</head>
<body>
<h1>Hello, world!</h1>

<p>Enter any word, name, or phrase to see if it's a palindrome! Ex: racecar</p>
<input id="userInput" type="text" name="" placeholder="Enter word">
<button id="clickMe" type="button" name="button">Click Me</button>
<h2 id="personName"></h2>
<h2 id="personStatus"></h2>
<h2 id="personOccupation"></h2>
<script type="text/javascript" src="/js/main.js"></script>
</body>
</html>
47 changes: 47 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
document.querySelector('#clickMe').addEventListener('click', checkInput)

function checkInput(){

const userInput = document.querySelector("#userInput").value;
console.log(userInput)

fetch(`/palindromeAPI?text=${userInput}`)
.then(response => response.json())
.then((data) => {
console.log(data);
document.querySelector("#personStatus").textContent = data.status
});

}

// document.getElementById("clickMe").onclick = makeReq;
//
// function makeReq(){
//
// var userName = document.getElementById("userName").value;
//
// var request = new XMLHttpRequest();
// request.open('GET', '/api?student='+userName, true);
//
// request.onload = function() {
// console.log("works")
// if (request.status >= 200 && request.status < 400) {
// // Success!
// var data = JSON.parse(request.responseText);
// console.log(data)
// document.getElementById("personName").innerHTML = data.name
// document.getElementById("personStatus").innerHTML = data.status
// document.getElementById("personOccupation").innerHTML = data.currentOccupation
//
// } else {
// // We reached our target server, but it returned an error
//
// }
// };
//
// request.onerror = function() {
// // There was a connection error of some sort
// };
//
// request.send();
// }
13 changes: 13 additions & 0 deletions node_modules/figlet/.jshintrc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/figlet/.npmignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions node_modules/figlet/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions node_modules/figlet/Gruntfile.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions node_modules/figlet/LICENSE.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading