replace for loop of javascript using jQuery
<p>I wrote a sample html which retrieves the JSON from servlet and displays. But only the thing is i want to know how to iterate the returned JSON response using jQuery. Currently i'm iteratng using javascript for loop.</p>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;script type="text/javascript" src="javascript/jquery-1.4.4.js"&gt;&lt;/script&gt;

&lt;!-- Here we need to load the trends on page load starts --&gt;
&lt;script&gt;
 $(document).ready(function(){

     // now load the results from servlet

    // $("#trends").load("ReadRSSTrendsUsingServlet");

        // now get the result and retrieve each entry

        $.getJSON("ReadRSSTrendsUsingServlet",function(data){

       //  alert(data.trends[2]);

        for(var i=0;i&lt;data.trends.length;i++)
        {
         $("#trends").append(data.trends[i]).append("&lt;br&gt;");

        }
            });


 });

 &lt;/script&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
&lt;title&gt;Insert title here&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id="trends"&gt;
&lt;!--  Here is the data to be loaded --&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>After that it displaying the list of JSON values. My JSON object is like below</p>

<pre><code>   {"trends":["test1","test2","test3","test4","test5"]}
</code></pre>

<p>What i want is to know the equivalent of jQuery for below steps</p>

<pre><code>for(var i=0;i&lt;data.trends.length;i++)
        {
         $("#trends").append(data.trends[i]).append("&lt;br&gt;");

        }
</code></pre>
