title: How to edit a jsTree node and get the new name?
body: <p>I have a JS-Tree in which I want to add nodes. After adding the node, I want it to be given a name by the user. I want to make an AJAX call using this name. But my code is not working as expected. What am I doing wrong ?</p>
  
  <pre><code>tree.on('rename_node.jstree', function(e, data) {
    directory_name = data.text;
  })
  
  function createFolder($node) {
    $node = tree.jstree('create_node', $node, { li_attr: { "type": "folder" }});
    tree.jstree('edit', $node);
    $.ajax({
      type: "POST",
      url: new_folder,
      data: {
        'directory_name' : directory_name
      },
      success: function(message) {
        toastr.success(message);
      },
    });
  }
  </code></pre>