I'm using Fancytree, and I'm creating a new node using the ExtEdit extension. The title (main text) of the node appears to be set correctly, but the value consistently changes between two console.log()
statements and the wrong value is being sent to the server.
What's going on here? This is boggling my mind.
Here's the FancytreeNode
API.
This is the full function I'm using:
function createNode(data) {
console.log('this is the data object');
console.log(data);
console.log('this is data.node.title');
console.log(data.node.title);
$.ajax({
method: 'post',
data: {
name: data.node.title,
parentId: data.node.parent !== undefined ? data.node.parent.key : null
},
url: '/my/url'
}).success(function (thisData, status, jqXHR) {
data.node.key = thisData.id;
});
}
This is the output. Notice how data.node.title
is different.