Reputation: 10685
I have below javascript object handy with me. I want to read it and display on HTML page.
var info={
"name":"Christina",
"age":25;
"city":"Chicago",
"post":"CMO"
};
I want to display above information with ExtJS api.
<ul>
<li>Name is ...Christina </li>
<li>Age is ... 25</li>
<li>City is ... Chicago</li>
<li>Post is ... CMO</li>
</ul>
Thanks in advance !
Upvotes: 1
Views: 441
Reputation: 4581
There is Ext.Template class for this purpose. The code should be like
var t = new Ext.Template([
'<ul>',
'<li>{name}</li>',
'<li>{age}</li>',
'<li>{city}</li>',
'<li>{post}</li>',
'</ul>'
]);
t.compile();
t.append('some-element', info);
Upvotes: 5