Q:

JSON object not refreshed after updates (cross-domain)

I'm trying to request JSON document from another domain, and it works.
But, my main problem is that JSON is not updating the objects after updates.
Here's my Previous/Before updates JSON Data.
{
    "name": "human",
    "version": "1.0",
    "list": [
        {"name": "Human1", "blood": "A"}
    ]
}

This is my AJAX Function
function getHumans () {
    $.ajax({
        type: "GET",
        crossDomain: true,
        cache: false,
        url: "https://some.website/file.json",
        dataType: 'json',
        success: function (data) {
            console.log(data);        
        }
    });
};

First request was perfectly fine, with output:
{name: "human", version: "1.0", list: Array(1)}

And then, I'm trying to add another object on list array. So, the Array should be (2), but it's not. the Array still (1), I also turned off my cache, but did not work.
I want the JSON to automatically update/refresh the objects, without reloading or refreshing the page. I use this on Electron.

A:

You should use .push() to add elements. Let's suppose:
a = {name: "human", version: "1.0", list: [1]}

a.list.push(2);

results in:
{name: "human", version: "1.0", list: [1,2]}

if your new list element comes from data:
a.list.push(data.list[0]); //or similar

If you want to replace the whole list array, then:
a.list = data.list;

Keep in mind that var a in this case is needed to live out of the context of your getHumans() function so, each time you call getHumans() that function must update the value of a, you could pass the variables as a parameter or perform something like  a =  getHumans() where getHumans() return the new value of a.

