What I'm looking for is either a function or a piece of code that could help me dump the results of an array into an HTML DIV. I know that there's different ways of doing so, but these all require iterating through the array. What I'm looking for is more like a mapping tool. For example:
Let's imagine I have the following array in my javascript:
var myarray = [];
myarray['name'] = 'value1';
myarray['lastname'] = 'value2';
myarray['address'] = 'value3';
What I'd like to do next is somehow associate each of those values of the array to their equivalents in an HTML DIV. For example:
<div id="name"></div>
<div id="lastname"></div>
<div id="address"></div>
Or EVEN better, I'd like to be able to have a table in my HTML that could be fetched with this information without using DIVs. Something like:
<table width="277" height="146" border="1">
<tr>
<td width="97">Name</td>
<td width="87">{name}</td>
</tr>
<tr>
<td>Lastname</td>
<td>{lastname}</td>
</tr>
<tr>
<td>Address</td>
<td>{address}</td>
</tr>
</table>
So the idea is that when I get the values in my Javascript (via jquery) I can write the whole content of the array to the HTML table without having to iterate through each of the values of the array.
Any ideas if there's something out there that could help me achieve my goal?