1
votes

I am using jQuery and JsRender to render my template.

Here is my jsfiddle example: http://jsfiddle.net/kWBFS/8/

Could anyone please tell me how should I access values of particular arrays?

Currently I'm gettin only [object Object] and don't know how to access its contents.

Thanks a lot!

1
You can't link source code from github. Check the error console: Refused to execute script from 'raw.github.com/BorisMoore/jsviews/master/jsviews.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled. - cfs
I updated your fiddle so that the source links correctly now - cfs
Thanks cfs, it seemed to work for me. Sorry, first time using this. Any ideas about the issue? - user1029968

1 Answers

2
votes

I've never used jsRender before, but this template seems to give you the correct output. You need to iterate over the items in the R1 array using a for loop:

<script id="template" type="text/x-jsrender">
    {{for R1}}
        Column: {^{:#index+1}}
        {{for #data}}
            <p>{{:K1}} {{:K2}}</p>
        {{/for}}
        <br>
    {{/for}}
    <br>
</script>