title: How can I perform calculation in Javascript
body: <p>I have 2 tables in a class: </p>
  
  <pre><code>public class Table1 {
      public string Name{set;get;}
      public string Price{set;get;}
  }
  public class Table2 {
      public string Name{set;get;}
      public string Price{set;get;}
  }
  </code></pre>
  
  <p>I have two input fields, one have name from table1 and another name from table2, based on whatever Name a user selects from both tables. Jquery should add price based on two of the selected names.   </p>
  
  <pre><code>$(document).on("click", "#buttonClick", function () {
      for (var price in data) {
          if () {
  
          }
      }
  });
  </code></pre>
  
  <p>Question: how can i pass table1 Name and Price to jquery. When i click <code>#buttonClick</code> it should calculate price. For example:</p>
  
  <pre><code>Table1
  Name       Price
  RoomA      $22 
  RoomB      $23
  
  Table2
  Name       Price
  BuildingA  $33
  BuildingB  $30
  </code></pre>
  
  <p>If i select RoomA from field1(Table1) and BuildingA from field2(Table2) then i should get output as $55. So how can i pass Name and Price from Table1 and Table2 to jquery.
  I am getting Name and Price from database.</p>