0

I have a map marked with markers where there are niches. When the user clicks a marker, a popup shows up with a photo of that particular niche (say named Niche1.JPG). For some niches I have other photos like of its lampholder or plaque (say named Niche5_Lamp.JPG and Niche5_Plaque.JPG). I created a group of 3 radio buttons at the top of the popup but I want the last 2 to be grayed if the image of lampholder or plaque does not exists for that particular niche. I am using JQuery and my problem is how to check if the particular file exists without loading it (I have tried several examples which used JQuery.Ajax but didn’t work).

Nikos
  • 1
  • 1
  • 1
    So the suggestions like the one on this page are not working? https://stackoverflow.com/questions/3646914/how-do-i-check-if-file-exists-in-jquery-or-pure-javascript – Mohammed Swillam Jun 23 '19 at 20:35
  • With JQuery.Ajax, giving it the url of the file, say of Niche5_Lamp.JPG goes to the fail function even if the file exists, and I think with JQuery.Ajax it actually loads the file which is not what I intend (I only want to check if file exists and if so activate the corresponding radio button, and when clicked shows the corresponding photo) – Nikos Jun 23 '19 at 20:42
  • I've an idea. why don't you (in addition to the response returning from the server side code) send some sort of map/array/state which indicates the status of the files, and based on that you will use jQuery/js to gray out/show the radio button(s)? – Mohammed Swillam Jun 24 '19 at 08:41

0 Answers0