3

Is there a way to template the results of a AJAX query that returns JSON data? The JSON is returned to a module.

4
  • 5
    Nothing built in, no
    – Clive
    Jan 30, 2013 at 14:03
  • Well, just because it isn't built doesn't mean that someone hasn't tackled this issue w/ either a custom module or release a contrib module :)
    – mpdonadio
    Jan 30, 2013 at 17:44
  • You can create client side theme functions. Look at the examples here: engineeredweb.com/blog/11/5/javascript-theme-functions-drupal
    – berliner
    Feb 16, 2013 at 15:15
  • 1
    I've used handlebars.js personally
    – cdmo
    Jan 20, 2015 at 19:34

1 Answer 1

0

I would use the hook_theme and use a custom .tpl file to theme the results of an ajax output by sending the variables to the template(tpl) file using the theme function.

Not the answer you're looking for? Browse other questions tagged or ask your own question.