The code below doesn't work. Trying to search weather locations. When I search nothing happens.
<input type="text" id="query" /><button>search</button><br />
<div id="results">
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
var url='http://autocomplete.wunderground.com/aq?format=JSON&query=';
var query;
$('button').click(function(){
query=$("#query").val();
$.getJSON(url+query,function(json){
$.each(json.results,function(i,location){
$("#results").append('<p>'+location.name+'</p>');
});
});
});
});
</script>
FYI I am very inexperienced at coding (copied script from another website)