i am new to Json and Jquery.
Today i made this little code but its not working. I guess i wrote it right, but i know there is some little mistake somewhere. can you please help me to figure it out?
<!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>
data
as an argument and usesresult
in the function – axelcdv Aug 4 '13 at 7:32