I am having some difficulty extracting json data from a returned hash table.
From the geocode data that is returned the following console.log(data) console.log(data["latitude"])
Results in: {"latitude": "55.272766", "longitude": "-114.762116"} undefined
Checking a javascript created hash var foo = {"foo": "footoyou", "bar": "barandbeyond"} console.log(foo) console.log(foo["foo"])
Shows me Object foo=footoyou bar=barandbeyond footoyou
So obviously the json data is not is a json form, but rather just text.
Here is my controller code, where coords is the hash table respond_to do |format| format.js { render :json => coords.to_json, :layout => false} end
I am getting the exact same output if I use :json => coords.to_json or just :json => coords
Help is appreciated.