title: jQuery .change with .each inside not firing properly
body: <p>I have a simple .change function that goes to the database and gets some values sets some values, ect.</p>
  
  <pre><code>$('.linequantity').change(function() {
      ...
      $.getJSON(url, function(data) {
        $('#TT-' + lineItem).text(parseFloat(data['price']) * quantity);
      });
  });
  </code></pre>
  
  <p>What I want to then, is on any of the linequantites changing, I want to update the subtotal.  (Yes it's a catalog type/shopping cart style app).  My thought was, lets use a .each</p>
  
  <pre><code>$('.linequantity').each(function(){
       ...
     var url = "jQueryFunctions.php?action=getPrice&amp;quantity=" + quantity + "&amp;customer=" + customerID + "&amp;item=" + lineItem;
  
      $.getJSON(url, function(data) {
         subtotal = subtotal + (parseFloat(data['price']) * quantity);
       });
     });
  
     $('#subtotal').text(subtotal);
  </code></pre>
  
  <p>when I do this though, I get 0 for the subtotal, if the each even fires at all.  </p>
  
  <p>I have tired putting the .each in a function. When I moved the .each into it's own function it fired more consistently, but the getJSON, which in the .change works just fine gets skipped.</p>
  
  <p>Am I running into a conflict of the first json request isn't quite complete before I ask for another one?  </p>
  
  <p>I am open to a change in methodology, but thing the above has the right idea/start to it.</p>
  
  <p>Any ideas?</p>
  
  <p><strong>EDITS</strong><br>
  quantity field</p>
  
  <pre><code>&lt;input type="text" class="linequantity" id="SQ-&lt;?php echo $value['itemNumber']; ?&gt;" name="Quantity" placeholder="#"/&gt;
  </code></pre>
  
  <p>total span</p>
  
  <pre><code>&lt;span id="subtotal" class="currencyField"&gt;$0.00&lt;/span&gt;
  </code></pre>
  
  <p>11:44 EDIT:
  I think the .each is hitting before the getJson completes.  How can I make sure the json request completed before I do not jQuery</p>