views:

112

answers:

1

I currently have a JSTree all set up to do the creation and renaming of a new node:

.bind("create_node.jstree", function (NODE, REF_NODE) {
               $.ajax({
                   async: false,
                   cache: false,
                   type: 'POST',
                   url: "ApplicationAJAXHandler.aspx?action=CreateMenuItem&ApplicationID=" + document.getElementById('<%=hdnSelectedAppID.ClientID %>').value + "",
                   data: {
                       "operation": "create_node",
                       "ref": REF_NODE.args[0][0].id,
                       "title": REF_NODE.rslt.obj[0].innerText
                   },
                   success: function (data) {
                       console.log(data);
                   }
               });
           })
           .bind("rename_node.jstree", function (NODE, REF_NODE) {
               $.ajax({
                   async: false,
                   cache: false,
                   type: 'POST',
                   url: "ApplicationAJAXHandler.aspx?action=UpdateMenuItem&ApplicationID=" + document.getElementById('<%=hdnSelectedAppID.ClientID %>').value + "",
                   data: {
                       "id": createdNodeID,
                       "title": REF_NODE.rslt.obj[0].innerText
                   }
               });
           })

The problem is that my success doesn't seem to get hit when I return an integer ID on the create node, thus I can't set it to a global variable. What exactly do I need to return in the function to get back the ID from the server? I'm simply returning a new integer right now.

A: 

I ended up creating a single JSTree object, serializing it, and sending it through the pipe as JSON. Worked like a charm.

jlrolin