How to return complex html from an action via json?

An ajax request comes in, gets processed and then I want to return html. Not a whole html file, but some html which can be complex, with css styles and inline js.

How can I create a partial template, read it and return it as a field json response? Say, “empty_data_table.html”

1 Like

Usually You would return JSON and have it interpreted client side, so You can have data on the wire only.

But if You want to return html, You can have a look at the Drab libary.

1 Like

I’d be looking to use and put it in the json field you want