Let's say I have a set of pre-loaded images on a web page. When selecting any image from the list, AJAX request is made to another service, which returns HTML payload with multiple HTML elements, related to the selected image. Once returned, HTML payload is placed underneath the selected div. I cannot change what and how this service returns the data.
I need to prevent the following: avoid doing AJAX request if image was already clicked(AJAX is already made for the image) by user during the one page load. Essentially, I want my ajax request to happen one time max for one image per one page load. Note: I cannot change the output of the service that I call with ajax. All I can is placing html response of ajax request into some div.
What are the common jquery/javascript solution for this kind of problem?