Bootstrap progress bar using $.get <p>I realize there are a good number of progress bar related questions already present on SO. I browsed through many of them and was unable to get things working.</p> <p>Simply put, I am developing a page in JSP and I want to use an animated progress bar within bootstrap to display while the calls are being made for the data.</p> <p>HTML:</p> <pre><code>&lt;div class="row-fluid"&gt; &lt;div class="span12 progress progress-striped active"&gt; &lt;div id="searchAnimation" class="bar" hidden="true"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Servlet (Not sure if this part is relevant, but better safe than sorry):</p> <pre><code>@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //String that gets returned as HTML StringBuilder returnAsHTML = new StringBuilder(); //See if the class is closed, has a lab, or is just a regular class for(ClassInfo classes : springClassListings) { //Class is full, style accordingly if(classes.getSectionMeetingInfo().contentEquals("LEC") &amp;&amp; classes.getSectionEnrolled().contentEquals("0")) { returnAsHTML.append(closedClass(classes)); } else if(classes.getSectionMeetingInfo().contentEquals("LAB")) //These are labs, style accordingly { returnAsHTML.append(labClass(classes)); } else //These are normal classes without lab components { returnAsHTML.append(openClass(classes)); } } response.setContentType("text/html"); response.setCharacterEncoding("UTF-8"); response.getWriter().write(returnAsHTML.toString()); } </code></pre> <p>And my scripting:</p> <pre><code>//Serves up the data $('#btnData').click(function() { //THIS IS THE PROGRESS BAR $("#searchAnimation").show(); $.get('daoServlet', function(responseText) { $('#dataDisp').html(responseText); }); }); </code></pre> <p>I get the idea, % the width of the progress bar by a where the $.get call is at in terms of getting the data. I just don't understand how to do it.</p> <p>PS - I know my for/if in the doGet is a nasty anti pattern, I just haven't figured out a way around it yet.</p>