So I have multiple objects that I get from an AJAX request that looks like [Object, Object, Object, Object, Object, Object, Object, Object, Object, Object]
.
So I
for (var prop in dateArray) {
if (dateArray[prop].date === sdate) {
}
}
sdate
is a variable that has a list of dates. That I get from jQuery UI
and dateArray
is all my objects.
My object looks like:
0: Object
available : true
date : "01/01/2017"
stock_qty : 0
time: "07:30pm"
title: "The seeing"
So I can iterate over them, and do I check to say if var A
matches dates in var B
do something. I'm struggling in how I then append the information in the object that matches to the element on the DOM.
Within my loop, when I find a match, i'm trying to write all the info in the objects into the DOM
via html
attr
but i'm struggling. But i'm not sure how I refer to the match, like within my loop when it matches a date with another date, how can I then pull out all the objects from that match?
It's quite a vague question I know, sorry! I know what i'm trying to do, I just can't figure out how i'd do it in JavaScript.
Thanks in advance!