Page 1 of 1

Can you help me with jQuery ?

Posted: Fri Dec 17, 2010 11:51 am
by jankidudel
Hi, I have 10 titles and 10 descriptions of the products for the online shop in products.txt
titles are in title class
descriptions are in descriptions class
How can I put them like this in my div

<div class='content'>
<title1>
<description1>
<title2>
<descirpiton2>
and so on.....
</div>

I've tried to wrote some script in jQuery, but I'm only couple of days familiar with it, and I can't do it myself for now
<script>
$('.content').load(''products.txt .titles // but how can I mix them ?

I don't know, maybe I should better use .ajax method ?


thank you very much

Re: Can you help me with jQuery ?

Posted: Fri Dec 17, 2010 5:25 pm
by pickle
The .ajax() method is more powerful & necessary if you plan to do any parsing of the content returned by your AJAX call. How is products.txt structured? You'll likely need to do some parsing of the text you get back, then loop through it, creating the DOM elements in each loop and inserting those new elements into the page.