Can you help me with jQuery ?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
jankidudel
Forum Commoner
Posts: 91
Joined: Sat Oct 16, 2010 4:30 pm
Location: Lithuania, Vilnius

Can you help me with jQuery ?

Post 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
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Can you help me with jQuery ?

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply