How to remove duplicate values in a loop

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Anes

    How to remove duplicate values in a loop

    Hi pals,
    I plan to create a HTML rows using jQuery, where the
    rows data come as JSON . When I take this data in a loop
    the same data set is repeat twice , so get a duplicate
    entry of already existing row.
    my code is :

    Code:
    $("div#pre").html("");   
    var j = 0;   
    $.each(server_response.access_servers, function(i,access_servers){
      alert(access_servers.servername);
      var tblRow =
    						"<tr id=\"container_tr\">"
    						+"<td>"+access_servers.servername+"</td>"
    						+"</tr>"
    					$(tblRow).appendTo("div#pre");
      });
    The JSON data has no duplicate value , So How can I eliminate this, reply me with ASAP.

    Thankfully
    Anes P.A
    Last edited by Dormilich; Nov 10 '10, 06:25 AM. Reason: please use [CODE] [/CODE] tags when posting code
Working...