I'm requesting a list of jobs as JSON (complex object of objects & arrays), at a set interval, using AJAX. I'm then updating parts of a page using the returned data.
The issue is that I only want to update the page with any new jobs and I can't compare the number of objects because of how other things are implemented.
How can I only return only new object(s) by comparing oldData
& newData
?
Example JSON object:
{
latStamp: 32.6132698059082,
timeStamp: "2014-06-20 07:05:00+00:00",
job: {
status: 8,
customer: "Mr Crustomer",
task: "Some task",
machineType: "XE3000",
tempJobNumber: "GO28323",
jobNumber: "GD23203",
causeOfFault: "",
workCarriedOut: "",
jobOwnerName: "Job Owner",
machineSerialNumber: "",
costCentre: 1,
mileage: 0,
location: "Location",
scheduledDateTime: "19/06/2014 17:00:00",
shortDescription: "",
id: 1,
engineer: 1
},
status: {
actionGuidance: "Action guidance here",
description: "Completed",
endsTimer: true,
colour: "73B63F",
startsTimer: false,
id: 8
},
lngStamp: 4.886201977729797
},
Edit: I don't think this is a duplicate, as suggested link returns an object containing multiple empty objects – I'm looking to return an object containing only the different objects