开发者

Ajax calls to the server from canvas tag?

I have a rails server that has a page with canvas tag containing some images and user interface. Some objects inside the canvas have on mouse click events assigned. I wonder if it's possible to execute ajax calls on clicking the item then processing some data inside the ruby on the rails server and comeback to canvas changing some objects there inside? Like removing or changing their state etc? Once the canvas is initialized it looks like I can't access the objects inside anymore. I'm not quite profi in html5 :(

any advice is appreciated,

Th开发者_如何学运维anks


Canvas is just an image created programmatically, therefore if you want specific regions of the canvas clickable my suggestion would be to position another html element ovetop of the canvas on a higher zindex. For example you could bind a click event to a div tag and then when you get your response from the server back you could update the canvas.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜