Create WBS Code

I should love to create WBS Code for the new task.

Momently, I use this poor code:

gantt.attachEvent(“onAfterTaskAdd”, function(id,item){
var new_wbs = “X.y”;
gantt.getTask(id).WBS = new_wbs;
gantt.updateTask(id);
});

Basically, I have the WBS of parent and the next free number in the Gantt table, but I do not able to call the parent properties in this part.

I have tried -->
var new_wbs = “”+gantt.getTask(task.$parent).WBS+"."+gantt.getTask(task.$parent).Free_srsz+""
without success.

Have any method to access all of the parent data?

gantt.serialize looks like it’s supposed to return the data in either json(default) or xml but it doesn’t seem to be working. Just returns this…

function (t) { return t = t || "json", this[t].serialize(); }

Rookie mistake I guess but I was sure the function was returned when I did gantt.serialize(). Oh well, seems to be working now. I just need to convert it now so that I can send it via ajax…

$j.ajax("/someplace/method?data=" + JSON.stringify(gantt.serialize()));

ajax doesn’t seem to like it.

I should love to create WBS from an other application. So to reach the parent data is a very important for me…

This worked for me…

$j.ajax("/scheduling/save_schedule", {
              data : json,
              contentType : 'application/json',
              type : 'POST'
});