Created
August 9, 2013 00:14
-
-
Save emanuelpessoaa/6190047 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$(document).ready(function(){ | |
// alert('ready'); | |
var moviehash; | |
$('form').on('submit', function(event){ | |
// alert('submit'); | |
event.preventDefault(); | |
var form = $(this); | |
var inputwithspace = $('#movieinput').val(); | |
var inputhtmlfriendly = inputwithspace.replace(' ', '%20'); | |
$.ajax({ | |
url: 'http://www.omdbapi.com/?s=' + inputhtmlfriendly, | |
method: 'get', | |
datatype: 'jsonp', | |
success: function(movielist){ | |
$('.test').append(movielist); | |
moviehash = movielist; | |
// $('movieresults').append(moviehash); | |
} | |
}); | |
}); | |
}); | |
//http://www.omdbapi.com/?i=&t=matrix | |
//http://www.omdbapi.com/?i=&s=matrix multiple results | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<link href="bootstrap-combined.no-icons.min.css" rel="stylesheet"> | |
<link href="style.css" rel="stylesheet" type="text/css" /> | |
</head> | |
<body> | |
<!-- <p>Hello World | |
--> | |
<form> | |
<input id="movieinput" type="text" placeholder="Enter a movie"></input> | |
<button id="add-button">Add</button> | |
</form> | |
<p class="test"></p> | |
<p> | |
spacejam | |
</p> | |
<p class="movieresults"> | |
</p> | |
<script src="jquery.min.js"></script> | |
<!-- <script src="jquery-ui.min.js"></script> --> | |
<script src="moviesearch.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment