ruby / sinatra serving "object.to_json" for 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); ...
as a result, the div is filled only with the symbol "#".
console.log (data) shows:
#<Human:0x10aa540 @x=68, @y=24, @name="Adam", @age=50>
So, I assume that this is happening because "<" and other characters are interpreted in html. How can I avoid this and show the object on the web page, how does it appear on the debug console?
thanks
source share