PHP Echo into nodeDataArray

I’m using the ‘Distances’ sample as a template for my test project.
When I ‘hardcode’ the nodeDataArray variable when my PHP Variable it works fine.
When I try to use PHP echo, no graph is displayed. I have run my variable though jsonlint and it ‘passes’.
Here is what I am trying :
var nodeDataArray = “<?php echo $allnodes2 ?>”;

Any help would be greatly appreciated!

Here is my PHP variable $allnodes2 :

[{"key":"1241","text":"Test1","address":"","phone":"","district":"AGency","maincontact":"","desc":"","image":"","color":"#8B008B"},{"key":"1242","text":"Test2","address":" ","phone":"--","district":"Employer","maincontact":"","desc":"","image":"","color":"#8B008B"},{"key":"1243","text":"Test3","address":"1234 Smith Street Blyte CA 9331","phone":"123-123-1234","district":" College district","maincontact":"","desc":"some desc","image":"","color":"#8B008B"},{"key":"1244","text":"Test4","address":"","phone":"","district":"College district","maincontact":"","desc":"","image":"","color":"#8B008B"},{"key":"1245","text":"Test5","address":"","phone":"","district":"College district","maincontact":"","desc":"","image":"","color":"#8B008B"},{"key":"1246","text":"Test6","address":"","phone":"","district":"College district","maincontact":"","desc":"","image":"","color":"#8B008B"}];

I don’t know, this is more a PHP/general JavaScript question than a GoJS question.

It might be that you are using double quotes in both places. Try changing the expression to single quotes:

'<?php echo $allnodes2 ?>';

It didn’t work, but thank you for the idea…I’ll keep plugging away

i think echo will produce a string. and nodeDataArray needs a json. try to convert your output to json.

Thanks very much for the idea. I had previously tried including “json_encode” in the echo to no avail.