I have 3 JSON
: clinics, location and specialty, I'm trying to filter by location and by specialty with Javascript, the idea is that selecting the 1 or 2 filters together hide images from the page. The problem I have is that it works partially, for example: if I apply only one filter, there is no effect until I select the second filter. The JSON of Specialty and Locality, the charge in two Select
of HTML
separately and the JSON of Clinics use it to load images on the page HTML
.
I leave an example in JSFiddle: link
I do not know if it is the right way to do this, really, or if there is a better alternative, it was the way I thought of implementing, suggestions are also accepted.
JSON Clinics:
[
{
"idc": "6",
"ima": "clin-test1.jpg",
"title": "Clin Test 1",
"especialidades": "-4-16-",
"idlo": "1"
},
{
"idc": "11",
"ima": "clin-test2.png",
"title": "Clin Test 2",
"especialidades": "-38-40-41-43-44-",
"idlo": "2"
}
]
JSON Specialties:
[
{
"ides": "4",
"nom": "Alergista"
},
{
"ides": "6",
"nom": "Cardiologia"
},
{
"ides": "11",
"nom": "Cirugia"
},
{
"ides": "40",
"nom": "Cirugia Bariatrica"
},
{
"ides": "44",
"nom": "Cirugía Plástica"
},
{
"ides": "1",
"nom": "Clinica Medica"
},
{
"ides": "8",
"nom": "Cosmiatria"
}
]
JSON Location:
[
{
"idlo": "1",
"nom": "Ciudad1"
},
{
"idlo": "2",
"nom": "Ciudad2"
},
{
"idlo": "3",
"nom": "Ciudad3"
},
{
"idlo": "4",
"nom": "Ciudad4"
}
]