My goal is to compare two different JSON services and show the difference in a seperate div. Service A shows lists a user is enrolled in. Service B shows all lists available. I want to be able to show the user's lists in one div and the remaining lists from the major list in another.
Both sets of info come from internal JSON services. My first approach was to take the list ID's from each (they are the same)and store them in array's and compare the arrays. Service A(ob1):
1,2,3,4
Service B(ob2):
-1,1,2,3,4
Here is the comparison, which started from another SO post
$.grep(ob1, function (el) {
if ($.inArray(el, ob2) == -1) diff.push([el, IDl]);
});
result: If a user has 1 list ID then only a single result with the ID from the last item in the JSON call, instead of 4 with the name associated. The associated name is the "IDl" being pushed into the last array. Any help would be great.