How can I get JavaScript to read server HTML and build objects off of it?

  • afaict, you can't do what you're trying to do. You have annotate the HTML somehow to indicate where the bindings were, reverse-engineer the data out of the rendered template, and build a proper template from that so that you can then use an off-the-shelf js templating engine. You might as well just use standard handlebars and web services instead.

    If the extra http request from the web service is a real concern (and not just premature optimization), then you could dump the JSON data into a script tag and send that together with the template.