I'm pretty new to BackboneJs and I'm trully lost there, an all day lost facing this maybe simple problem.
I try to create an app which runs offline. So i don't use any model or collection, and strange things like .save, .fetch. I only use Backbone for history, structure and templating system.
My question is. I have some JSON, how can I display it in my template ?
My View, all is working til there. My json is in the jsonVar.
window.ExposView = Backbone.View.extend({ template:_.template($('#expos').html()), render:function (eventName) { console.log(jsonVar); // it's ok here $(this.el).html(this.template(),{"output":jsonVar}); return this; } });My Template (using jQuery mobile at the same time), I want my Json to show there.
<script type="text/tempate" id="expos"> <div data-role="header" class="header"> <a href="#" data-icon="back" class="back ui-btn-left">Back</a> </div> <div data-role="content" class="content"> <%= output %> </div> </script>
Error : output is not defined.. Well
Another question. If by any miracle my template receive my json output, how can I display it using underscoreJs ?
Thanks for your time, have a nice weekend.