Some what working. Can now create json array and output it to my view. but it is calling function as soon as the view comes up. need to stop that.
Also removing code that I don't need anymore.