Skip to content

Instantly share code, notes, and snippets.

@ColeMundus
Created March 2, 2017 00:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ColeMundus/3d67fa2bf3aede0c44a95cd240210763 to your computer and use it in GitHub Desktop.
Save ColeMundus/3d67fa2bf3aede0c44a95cd240210763 to your computer and use it in GitHub Desktop.
<!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