I have a rough idea of the logic but if anyone can help, greatly appreciate it!
Trying to see if any of the numbers match in both the JSON (from a URL) and array. If it does, do something. In this example, 300 is the number that exists in both the JSON and array.
Possible logic / code
// FOR json
for(var i = 0; i < obj.length; i++) {
var myObjNum = obj[i];
}
// FOR myArray
for(var i = 0; i < myArray.length; i++) {
var myArrayNum = myArray[i];
}
// if cat ID is in the DOM and array, do something
if (myObjNum == myArrayNum) {
// if a number is found in both the array and JSON, do something here
}
JSON ( https://api.myjson.com/bins/svr3i )
[
{
"5774": {
"subCats": [
{
"town": "atlanta",
"state": "georgia"
}
]
},
"300": {
"subCats": [
{
"town": "new york city",
"state": "new york"
}
]
},
"899": {
"subCats": [
{
"town": "san diego",
"state": "california"
}
]
},
"2557": {
"subCats": [
{
"town": "chicago",
"state": "illinois"
}
]
}
}
]
Array
var myArray = [500,4743,300,77899];