Reputation: 1004
I'm using a jQuery gantt plugin from here and integrating it with a PHP site I have. In terms of setting up the demo there are no problems; however when I try to feed the plugin some of my own data, it will throw up the following error:
TypeError: e is undefined
Now, I believe the above error is thrown due to the JSON object being unfamiliar to the plugin but, I just can't seem to package it correctly.
Now, you can see other than a few differences, I am pretty close to the mark. Up next is the PHP code I use to generate this.
$aryOutput = array('source' => array());
if($aryTasks) {
foreach($aryTasks as $aryTask) {
$aryOutput['source'][] = array(
'name' => $aryTask['task_stage'],
'desc' => $aryTask['task_title'],
'values' => array(array(
'to' => '/Date('.time($aryTask['task_projected_end_timestamp']).')',
'from' => '/Date('.time($aryTask['task_projected_start_timestamp']).')',
'desc' => $aryTask['task_description'],
'label' => $aryTask['task_description']
))
);
}
}
$strJSON = json_encode($aryOutput, JSON_UNESCAPED_SLASHES);
Please can anyone offer some pearls of wisdom to resolve this matter. On a side note, from another question, I saw that the class has to be gantt. This is not a problem, I can get the plugin working with a different data set.
Thank you
I noticed a small difference with the date field having an extra slash on it. After editing the code to add it, the error still occurs
Upvotes: 2
Views: 1162
Reputation: 1004
Check the complete delivered JSON is structure as needs be. In the above example, it is likely this is the output:
source : { source : { ... } }
This causes confusion with the plugin as it is unexpected data.
Upvotes: 1