How to pass a php result into nodeDataArray and linkDataArray?

Were you trying to include the tag when you inserted the generated code? I asked you to insert the code inside your script tag. Use triple backquotes before and after the JavaScript code. Please read: Code Formatting