I am writing an application that displays a list of Job objects from an AJAX JSON response.
What is the best way to render markup from the returned data. Now I am pretty convinced that its a bad idea to create server-side HTML markup and return it from an AJAX call. From experience, it makes HTML support very difficult, and content refactoring is a nightmare, so I am returning a collection of Job objects as JSON.
The question is how to render HTML based on user input? I saw some examples of creating a markup template on a page, then use jQuery to clone and populate the corresponding insert data in the DOM.
The problem is that the template contains visible content (images, etc.), and the application needs to be degraded, so I have a relay on the page where the code is severside and is populated when the page loads if JS is not available.
Any advice would be appreciated.
Sheff source
share