Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 382185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:09:28+00:00 2026-05-12T15:09:28+00:00

i have a partial which contains a jsTree ( jsTree.com ). which i’ve setup

  • 0

i have a partial which contains a jsTree (jsTree.com). which i’ve setup to async loading of json data.
my controller returns json data in a format accepted by jsTree.

this all works perfectly, i can collapse node’s and the subnodes are loaded asynchronally like it should.

but when i make a change to my database (simple change of a name) i want to refresh the contents of the jsTree, therefore i call the $.tree_reference(‘mytree’).refresh() function provided by jsTree which does execute but does reflect made data changes

i dove into the code of jsTree and found the folowing peace of code which should asynchronally call the server/my controller:

  $.ajax({
                            type: this.settings.data.method,
                            url: this.settings.data.url,
                            data: this.settings.data.async_data(false, this),
                            dataType: "json",
                            success: function(data) {
                                alert("succes");//added for debugging
                                data = _this.settings.callback.onJSONdata.call(null, data, _this);

                                var str = "";
                                if (data.length) {
                                    for (var i = 0; i < data.length; i++) {
                                        str += _this.parseJSON(data[i]);
                                    }
                                } else str = _this.parseJSON(data);
                                _this.container.html("<ul>" + str + "</ul>");
                                _this.container.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");
                                _this.container.find("li").not(".open").not(".closed").addClass("leaf");
                                _this.context_menu.apply(_this);
                                _this.reselect.apply(_this);
                            },
                            error: function(xhttp, textStatus, errorThrown) { alert("error"); _this.error(errorThrown + " " + textStatus); } //alert added for debugging
                        });

as stated this works perfectly with normal traversing thrue the tree.
this method also gets called when i hit the refresh ( see the alerts ive added, i’v got the succes allert) and it returns data which gets correctly parsed by the rest of the jsTree code.

BUT. the data it returns basicly is data which it returned earlyer (when traversing thrue the tree) therefore not changing the tree.

Furthermore i’v set up a breakpoint in my controller, which breaks when traversing thrue the tree (thus when jquery asynchronally gets some json data). but it does NOT break when i hit the refresh method.

i’m asuming somehow the json data gets cached (when i open up a new instance of IE and browse to the tree, the tree DOES reflect the changed data, the first instance wont however (not with the refresh method, nor with the actual refresh button on IE itself))

not sure where the problem lie’s here, but sofar im pretty much convinced it should be in the caching of the $.ajax call.

any thought on where to continue debugging?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T15:09:28+00:00Added an answer on May 12, 2026 at 3:09 pm

    lol.. figures

    i’ve found the solution minutes after posting the question..

    Funny how typing out a question makes u rethink the problem (when i started typing out i didnt think of the cahcing yet)

    the solution here is adding

    $.ajaxSetup({ cache: false });
    

    before the ajax call or putting the cache: false inside the options of the $.ajax call itself
    ill be dropping a note to the creator of jsTree

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.