Reputation: 348
I have a dynamic table, am try to iterate a array object one by one in table.Am using Mustache template to iterate it.
<tbody>
<tr>
<td>{{ip}}</td>
**<td>{{#action-allow}}{{.}}{{/action-allow}}</td>**
</tr>
</tbody>
It should be first Row - Deny only ,Second row- Deny, and third row-Allow etc.
But am getting all together. How can i make it one by one.
I need exactly like below picture.
how to achieve this ?
The template what getting is "action-allow":["Deny","Deny","Allow","Deny","Deny"] "
Upvotes: 0
Views: 87
Reputation: 1527
try the following. Change action-allow to action only. Here is live demo http://jsfiddle.net/26dAy/2/
var data= '{"action":["Deny","Deny","Allow","Deny","Deny"]}';
var arr=$.parseJSON(data);
var arr2=arr.action;
$.each(arr2, function(i, item) {
alert(arr2[i]);
});
Upvotes: 1