我不想将 flickr 照片附加到我的网页上。我正在尝试从 json 回调中检索纬度和经度值。
这是我到目前为止的代码。当我将它加载到浏览器中时,什么也没有发生。
<!DOCTYPE html>
<html>
<head>
<title>Flickr Pie Chart</title>
<meta charset="utf-8">
<script type="text/javascript" src="/jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#driver").click(function(event){
var apiKey = '[YOUR API KEY]';
var url = 'http://api.flickr.com/services/rest/&method=flickr.photos.search&api_key=' + apiKey +'&per_page=500&tags=losangeles&has_geo=1&extras=geo,tags&format=json&jsoncallback=?';
$.getJSON(url, function(data){
//loop through the results with the following function
$.each(data.items, function(i,item){
var geoData +='latitude:' item.latitude + '' + '<br>';
geoData += '' + item.longitude;
$('#results').append(geoData);
});
});
});
});
</script>
</head>
<body>
<div id = "results"></div>
<input type="button" id="driver" value="Load Data" />
</body>
</html>