.each() update only first tag

.each() update only first tag

Dear all,

I have a problem with the iterator .each(). The goal of my code is to load the results from a previous vote round and displays it near the current votes. I inserted div tags with a specific id and iterate on it. In the .each() iterator I call a php function which search previous votes in database. The result of my code is that only the first div tag is updated and the following are one by one when I perform a refresh on the page...

The html code is the following :

  1. <td class="zoneVote" width='14%' >
     <div id="previousVote" title="11_22|2">none</div>
     <select id="currentVote" title="11_22|2" name="vote" >
      <option></option>
      <option> 1 </option>
      <option> 2 </option>
      <option> 3 </option>
      <option> - </option>
      </select>
    </td>getPreviousVote.js








this fragment is repeated several time with a different title.

  1. $(document).ready(function(){
        $("div[id='previousVote']").each(function(){
            var response = "";
            var title = $(this).attr("title");
            var chapter = title.substr(0, title.indexOf("_", 0));
            var row = title.substr(title.indexOf("_", 0)+1, title.indexOf("|", 0)-title.indexOf("_", 0)-1);
            var col = title.substr(title.indexOf("|")+1, title.length);
            var dataString = 'chap='+ chapter +'&row='+ row +'&col='+ col;
      
            response = $.ajax({
                type: "GET",
                url: "../functions/getPreviousRoundData.php",
                data: dataString,
                success: function(){
                }
            }).responseText;
      
            $(this).text(response);
        });
    });


















Thank you in advance to give me some information.

cdg