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

  • SEARCH
  • Home
  • 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 6551469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:20:32+00:00 2026-05-25T12:20:32+00:00

There are some nodes that get data from AJAX call in my jsTree. How

  • 0

There are some nodes that get data from AJAX call in my jsTree.

How can I refresh the data and NOT by reloading the whole tree?

  • the best would be simple click on the node I wish to refresh
  • context menu is ok too
  • 1 1 Answer
  • 0 Views
  • 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-25T12:20:32+00:00Added an answer on May 25, 2026 at 12:20 pm

    How about this?

    <html>
    <head>
    <script language="javascript" type="text/javascript" src="jquery.min.js"></script> 
    <script language="javascript" type="text/javascript" src="jquery.jstree.js"></script>
    <script>
    var treeConfig = { 
      "json_data" : {   
      "data" : [{
          "data" : "Root",
          "state" : "closed",
          "children" : ""
          }],
      "ajax" : {
          "url" : "http://localhost/tree.json",
          "data" : function (node) {                        
              return { query : "Value" };
          }
        } 
      },
      "plugins" : [ "themes", "json_data", "ui" ],
    };
    
    $(document).ready(function(){
     $("#treeContainer").jstree(treeConfig);
    
     $('#treeContainer a').live('click',function(){
        var tree = jQuery.jstree._reference("#treeContainer");
        var currentNode = tree._get_node(null, false);
        tree.refresh(currentNode);
     });
    
    });
    </script>
    </head>
    
    <body>
     <div id="treeContainer"></div>
    </body>
    </html>
    

    Here’s what I’m doing:

    • using the JSON data plugin (but the concept is similar for HTML and XML plugins)
    • loading the initial tree node (“Root”) from the data config object
    • setting the AJAX config object so all other nodes request their child data via ajax, when initially opened (applies to any node where ‘state’ is ‘closed’ and ‘children’ is ’empty’)
    • using the AJAX data function to pass the correct query string to get relevant data for the node being opened. My example always fetches http://localhost/tree.json?query=Value but you probably want to do something like set Value to the node id so the server sends back relevant data.

    So far this makes an ajax request for the node data only the first time the node is opened. The final step is:

    • create a click function which causes a single node to refresh its data every time it is clicked
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have noticed that some of my ajax-heavy sites (ones I visit, not ones
I've just discovered (by necessity) that TSQL has some functionality to extract data from
I get some data from a WebService, which looks like this Building Address ->
I need to check in some fast way if there is any text nodes
Is there some way I can use URLs like: http://www.blog.com/team-spirit/ instead of http://www.blog.com/?p=122 in
Is there some way to block access from a referrer using a .htaccess file
I see that SharePoint 2010 makes javascript ajax calls to some pretty slick internal
I am trying to use the HTML Agility pack to scrape some data from
How can I go about populating a simple Java object with data from any
I would like to retrieve some data from a Mongoose setting in my Node.js

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.