Ajax Function don't update

Hi there. I load some data from backend from a json file. My problem is: if i change the json file the application don’t get the changes on the json file.

So it looks like it would cache the data from the json file and don’t reload it anymore. Equal if i restart the studio or delete the site data from developer console (developer console / application / clear storage / clear site data).

For example in my json file stands at the start point:
‘text’: ‘i am a text’,
and update it to:
‘text’: ‘i am a awesome text’,

and restart the application it will load everytime:
‘text’: ‘i am a text’

here is my code:

export class Data{

    ajaxParam : Z.Ajax.Parameters = {
        url     : 'http://localhost/media/data.json',
        method  : "GET",
        timeout : 3000,
    }
    
    constructor(){}

    public getInitData(_callback : Function, _obj){

        Z.ajax(this.ajaxParam, (statusCode, data, request) => {

            console.log('start ajax');
            if (statusCode === 0) {
                console.log("Unable to connect - check network connection.");
                return;
            }

            if (statusCode < 200 || statusCode >= 300) {
                console.log("HTTP request failed: " + statusCode);
                return;
            }

            // Attempt to parse the data returned from the AJAX request as JSON
            let parsedData;
            try {
                // https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse
                parsedData = JSON.parse(data);
            } catch (e) {
                console.log("Unable to parse JSON: " + e);
                return;
            }
            
            // Check the data is as expected and display it
            if (parsedData.audio) {
                console.log(parsedData.audio);
            } else {
                console.log("Unexpected response from API");
            }

            _callback(parsedData, _obj);
        });
    }
}

Hey there @diana.fechner,

Can you make sure that you are saving the file and it have the same name as mentioned in the script in zappar.

Thanks
Ayushya

Yeah. After saving i reopen the file and the new data is written in the file and no more the old data.

Got it! @diana.fechner

Can you also check if the updated field have the same name ‘audio’ in the data as mentioned in your script?

Thanks
Ayushya

Sry was the last days really busy (exam preperations). The Point is that the application heavy caches the data. After i set a random variable to the request link it work all fine.