我正在使用 Flickr 的 API。我正在异步加载一些图像和相关元数据。我有一个脚本来完成所有这些,使用三个 AJAX 调用:
$(document).ready(function() {
var latLon = {
lat: 38.736946,
lng: -9.142685
};
var numero = 10;
var clicked = 1;
$("#sq").click(function() {
clicked = 1;
});
$("#lg-sq").click(function() {
clicked = 2;
});
$("#thumb").click(function() {
clicked = 3;
});
$("#small").click(function() {
clicked = 4;
});
$("#mid").click(function() {
clicked = 5;
});
$("#apagar").click(function() {
$("#results").html('');
});
$('#pesquisar').click(function() {
$("#results").html('');
$.ajax({
url: 'https://api.flickr.com/services/rest/?method=flickr.photos.search',
dataType: 'xml',
data: {
api_key: '2fd41b49fedfd589dc265350521ab539',
tags: $("#tag").val(),
format: 'rest'
},
success: sucessHandler,
error: errorHandler …Run Code Online (Sandbox Code Playgroud)