Want an ajax request was called only 1 time?

$.ajax({
 url: 'https://api.instagram.com/v1/locations/'+locationID+'/media/recent?access_token=' + token,
 dataType: 'jsonp',
 type: 'GET',
 data: {access_token: token, count: num_photos},
 success: function(data){
console.log(data);
console.log(locationID);
 for(x in data.data){
 $('#instagramIMG').append('<li><a href="'+data.data[x].link+'" target="_blank"><img src="'+data.data[x].images.thumbnail.url+'"></a></li>');
}
},
});


How to make GET request called only 1 time
It is in a popup
And when I open popup, the GET request is duplicated
July 8th 19 at 11:36
2 answers
July 8th 19 at 11:38
hachi... what side he then ajax request if you have it 2 times cause?
July 8th 19 at 11:40
Bind an event handler that will perform an AJAX request for the desired item, and after a successful performance - unlink handler. The query will be executed 1 time.

Find more questions by tags AJAXjQuery