如果我想在页面中进行两次不同的搜索结果,该怎么办?我试图复制此代码,但要更改新术语,但我只从第一个查询中获得结果:
var termS = "Paris";
var date = "1500";
$.getJSON("https://www.googleapis.com/customsearch/v1", {
q: termS + " in " + date,
alt: "json",
searchType: "image",
cx: "MY_CX",
key: "MY_API",
rights: "cc_publicdomain",
filter: "1",
num: "10",
fileType: "jpg",
imgType: "photo"
},
function (data) {
$.each(data.items, function(i,item){
$(".my_images ul").append('<li><img class="img-responsive" src="' + item.link + '"></li>');
});
});