Created
March 2, 2017 00:08
-
-
Save ColeMundus/4c5a0c1eacf0b8afb56e7d5db5b0fae5 to your computer and use it in GitHub Desktop.
This file contains 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"> | |
<title>Assignment</title> | |
<link rel="stylesheet" href="style.css"> | |
</head> | |
<body> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> | |
<div class="container"> | |
<h1>Spelling Bites</h1> | |
<div id="holder"></div> | |
<input id="words" placeholder="Type here"></input> | |
<button id="submit">Submit</button> | |
<script> | |
$(document).ready(function(){ | |
$.ajax({ | |
url: 'https://montanaflynn-spellcheck.p.mashape.com/check/?text=', | |
type: 'GET', | |
dataType: 'json', | |
success: function(data){ | |
console.log(data); | |
var words = document.getElementById("words").value; | |
$('button').click( function() { | |
words = document.getElementById("words").value; | |
url: 'https://montanaflynn-spellcheck.p.mashape.com/check/?text=' + words; | |
$('#holder').html( | |
'<h2>' + data.suggestion + '</h2>' | |
) | |
}); | |
}, | |
error: function(){ | |
console.log( 'ERROR' ); | |
}, | |
beforeSend: setHeaders | |
}); | |
}); | |
function setHeaders(xhr) | |
{ | |
xhr.setRequestHeader( 'X-Mashape-Key', 'LVI2Epd6lomshHqmfPO7UCplt908p1Sm5YxjsnOKt9N0Se4G6E' ); | |
xhr.setRequestHeader( 'Accept', 'application/json' ); | |
} | |
</script> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment