1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
$.ajax({
url: 'https://website/imagesInCat_ajax.php?catID=' + catconfirm + '&minLat=' + SWlat + '&maxLat=' + NElat + '&minLng=' + SWlng + '&maxLng=' + NElng,
type: 'post',
dataType: 'json',
success: function(response) {
$("#slider").empty();
photosB = [];
photosBbis = [];
var i;
for (i = 0; i < response.length; i++) {
console.log(i);
photounit = response[i];
var url = photounit.imgurl;
// var url = 'https://website/subsite/picture.php?/' + photounit.imgurl;
let split = url.split('/');
let imageid = photounit.id;
if (photounit) {
$.ajax({
url: 'https://website/subsite/ws.php?format=json&method=pwg.images.getInfo&recursive=true&image_id=' + imageid,
type: 'post',
dataType: 'json',
success: function(response) {
photosBbis.push({
id: imageid,
cats: response.result.categories[0].uppercats,
date: response.result.date_available
});
}
});
photosB.push({
id: imageid,
lat: photounit.latitude,
lng: photounit.longitude,
url: url,
// photo: photounit.linkurl,
photo: photounit.linkurl.replace("sq", "sq"),
caption: photounit.name,
comment: photounit.comment,
author: photounit.author,
thumbnail: photounit.linkurl.replace("sq", "2s"),
arraycomments: [],
// cat: cats2
});
var arraycomments = [];
$.ajax({
url: "../callfiles/services/read_photocomments.php",
method: "GET",
dataType: "json",
data: {
image_id: imageid
}, xhrFields: {
withCredentials: true
},
success: function(response) {
console.log(response);
for (let r = 0; r < response.length; r++) {
photosB[i].arraycomments.push({
content: response[r][0],
author: response[r][1],
});
}
},
error: function (response) {
console.log(response);
arraycomments = response;
console.log('comments error')
},
username: null,
password: null
});
}
}; |
Partager