E
E
eldar_web2015-05-26 18:24:52
Ruby on Rails
eldar_web, 2015-05-26 18:24:52

How to show a block from a handler in Rails using ajax ???

For example, we were able to send data through js and get a block like this:
$('.block').load('/view',data);
And in the handler file in php, we could send the html content like this:

echo "
<div>
Содержимое Содержимое СодержимоеСодержимое
Содержимое
Содержимое
</div>";

But how can you submit an html block in Rails? Is it so render text: "........"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Vsk, 2015-05-26
@eldar_web

You can text, you can partial, you can json, xml, pdf, file ...
In general, you can render what you need, what's the problem?
If you want, render one layout, if you want - everything, but without a layout, with an alternative layout.
You can do respond_with(@resource) and render in the format that the request came in.
Lots of possibilities

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question