How can I echo a views object ($data->nid) into javascript?
If I understand well your case, you can test if $data indeed is loading your desired data. you can do this with &lt;?php print_r($data); ?&gt; (or if you use Devel module, is best use &lt;?php dsm($data); ?&gt;). if you see the list of values, you also will see the respective keys's names of each value.

If you do not see values, you can load the respective node informatation with $data = &lt;?php node_load($IdNode) ?&gt; where $IdNode is the ID of your node. Remember &lt;?php dsm($data); ?&gt; to see the data of your node.