Search code examples
ajaxcachinggetjsonjstree

jstree 3.0.2 dynamic tree always loading data from cache instead of making a fresh call to server


I have a jstree. on load of the page the jstree populates fine from the server as it make a fresh call to server, but after that whenever I refresh the page it will always take the data from cache and not make a call to server , thereby always taking the old data to populate. I am using jstree 3.0.2 version. following is the code which generated the jstree on load of the page .

$('#tree').jstree({
'core': {
data:{
'url':'getjstree'   // this is the url which will get the json data from the server
}
}});

how do we solve this to get fresh data on each call, one solution which I earlier thought of using is the javascript code to hard refresh by calling

location.reload(true);

but that did refresh the json data but went into recursive call and thereby hanging the page. Please help how can we solve this issue.


Solution

  • using this solved the problem

    $('#tree').jstree({
    'core': {
    data:{
    'cache':false,
    'url':'getjstree'   // this is the url which will get the json data from the server
    }
    }});