ruby/sinatra serving an "object.to_json" to an ajax request:
...
content_type :json
adam.to_json
end
#--> #<Human:0x10aa540 @x=68, @y=24, @name="Adam", @age=50>
js with jquery:
...
$("#player").html(data);
...
resulting in div being populated with just "#" character.
console.log(data) shows:
#<Human:0x10aa540 @x=68, @y=24, @name="Adam", @age=50>
So I'm guessing that happens because "<" and other characters are interpreted to html. How can I avoid it and show the object in a web page as it appears on debug console ?
Thanks