I need to create an array of items. the array should contain the same number of items as my xml file holds "image" tags. Then, I need jquery to create an <li></li> and append it to an already established <ul></ul> in my html for each item in my array. here's my codes, abridged:
<div id="webthumbcontainer">
<ul id="webthumblist">
</ul>
</div>
- <div id="webthumbcontainer">
- <ul id="webthumblist">
-
- </ul>
- </div>
-
<category id="web">
<image>
<link>tadesign/images/carcare.jpg</link>
<description>Description text goes here about carcaredetail</description>
</image>
<image>
<link>tadesign/images/monster.jpg</link>
<description>Description text goes here about monster resolution</description>
</image>
<image>
<link>tadesign/images/rantingbill.jpg</link>
<description>Description text goes here about rantingbill</description>
</image>
<image>
<link>tadesign/images/voltecsite.jpg</link>
<description>Description text goes here about voltec design</description>
</image>
</category>
- <category id="web">
- <image>
- <link>tadesign/images/carcare.jpg</link>
- <description>Description text goes here about carcaredetail</description>
- </image>
- <image>
- <link>tadesign/images/monster.jpg</link>
- <description>Description text goes here about monster resolution</description>
- </image>
- <image>
- <link>tadesign/images/rantingbill.jpg</link>
- <description>Description text goes here about rantingbill</description>
- </image>
- <image>
- <link>tadesign/images/voltecsite.jpg</link>
- <description>Description text goes here about voltec design</description>
- </image>
- </category>
-
$.ajax({
url: "js/img.xml",type: 'GET',dataType: 'xml',timeout: 1000,error: function(){alert('Error loading XML document');},
success: function()
{
$(this).find('label').each(function(){
var blocks = $(xml).makeArray($(this).each('images'));
$('<li><a href="#"></a></li>')
.html(blocks).each()
.appendTo('#webthumblist');
});
}
});
- $.ajax({
- url: "js/img.xml",type: 'GET',dataType: 'xml',timeout: 1000,error: function(){alert('Error loading XML document');},
-
-
- success: function()
- {
-
- $(this).find('label').each(function(){
- var blocks = $(xml).makeArray($(this).each('images'));
-
- $('<li><a href="#"></a></li>')
- .html(blocks).each()
- .appendTo('#webthumblist');
- });
-
- }
-
- });
-
I'm trying my best here but I just don't know enough about xml, javascript, jquery, or ajax to get this done by myself. I've been researching like a madman but I'd appreciate your guys' input.
Essentially, I should get 4 objects in my array. I should also have 4 <li> in my <ul id="webthumblist">.
Use your words like arrows to shoot toward your goal.