我是 Json 和 Jquery 的新手。
今天我做了这个小代码,但它不起作用。我想我写得对,但我知道某处有一些小错误。你能帮我弄清楚吗?
<!doctype html>
<html lang="en">
<head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<script>
$(document).ready(function () {
$(":button").click(function(){
var add = $("#destination").val();
$.getJSON("http://maps.googleapis.com/maps/api/geocode/json?address= + add +&sensor=false", function (data) {
var output = "<ul>";
output += "<li>"+ results.geometry.location.lat + " " + results.geometry.location.lng + "</li>";
output += "</ul>";
document.getElementById("placeholder").innerHTML = output;
});
});
});
</script>
<body>
<input type="text" id="destination" /><button type="button">Search</button><br>
<div id="placeholder"> </div>
</body>
</html>