2 Replies Latest reply on Dec 7, 2011 2:28 PM by WestSide

    ColdFusion, jQuery, <cfloop>

    WestSide Level 1

      Hi,

       

      I am using CF 9 and jQuery.  I have a <cfloop> tag that I use to loop over some database records.  At each iteration of the loop I'm generating a progress bar using jQuery.  My code is something like this:

       

      <table>

        <cfloop query="q">

            <tr>

               <td>#firstName#</td>

              <td>#lastName#</td>

               <td>

                  <script type="text/javascript">

                         $(document).ready(function() {

                            $( "##progressbar#pkid#" ).progressbar({

                               value: #percentcomplete#

                             });

                          });

                   </script>

                </td>

              </tr>

      </cfloop>

      </table>

       

      The fields "pkid" and "percentcomplete" are coming back from my query.  I'm just looping over and generating a jQuery progress bar at each iteration. 

       

      So my question is, is this the way I should be doing it?  As of now, I will have multiple $(document).ready() blocks which feels a bit weird, but I'm wondering how can I achieve the same result another way using ColdFusion and jQuery? 

       

      Any thoughts would be really helpful.  So my code works and all is good, but is there another way I should be doing this?

       

      Thanks

       

      -Westside