title: How to connect php and jquery
body: <p>Is it possible to use php to compute something and use jquery to fetch the computed
  value and display it back to the webpage without the need to submit the form.
  I'm really having trouble using client-side to compute something that is using arrays. So I'm thinking of letting php do the computation.</p>
  
  <p>
                          
                          </p>
  
  <pre><code>                    &lt;input type="hidden" name=ids[] value="&lt;?php $id; ?&gt;"&gt;
                      &lt;input type="hidden" name=qoh[] value="&lt;?php $qtyhand; ?&gt;"&gt;
  
                      &lt;input type="hidden" name=dprice[] value="&lt;?php $dsprice; ?&gt;"&gt;
                      &lt;input type="hidden" name=sprice[] value="&lt;?php $ssprice; ?&gt;"&gt;
  
                      &lt;td&gt;$qtyhand&lt;/td&gt;";
                      &lt;td&gt;&lt;input type="text" name=qbuys[]  value="&lt;?php echo $ssprice; ?&gt;"&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php $ssprice; ?&gt;&lt;/td&gt;";
                      &lt;td&gt;&lt;input type="text" name=disc[]  value=""&gt;&lt;/td&gt;
  
  
                      &lt;td&gt;&lt;input type="text" name=subtot[]  value=""&gt;&lt;/td&gt;
  </code></pre>
  
  <p></p>
  
  <p>And here is the php file that is supposed to be used for computing. </p>
  
  <pre><code>&lt;?php
      $ctbill=0;
      foreach ($_GET['ids'] as $k =&gt; $v) {
          $id = (int)$v;
          $qtyhnd = (int)$_GET['qoh'][$k];
          $qtytbuy = (int)$_GET['qbuys'][$k];
          $left = $qtyhnd - $qtytbuy;
  
  
  
          $sellprice=(double)$_GET['sprice'][$k];
          $dealerprice=(double)$_GET['dprice'][$k];
  
          $finalvalue=.01;
          $dis=(double)$_GET['disc'][$k];
  
  
  
  
          $stotal=(double)$qtytbuy * $sellprice;
          $cdizval=(double)$stotal * $dis * $finalvalue;
          $cdstotal=$stotal-$cdizval;
  
          $ctbill=(double)$ctbill + $cdstotal; 
  
  
  
  
  
  
          $dizval=$dis * $finalvalue;
          $preprof=(($sellprice * $qtytbuy)-($dealerprice*$qtytbuy)) * $dizval;
          $profit=(($sellprice * $qtytbuy)-($dealerprice*$qtytbuy)) - $preprof;
  
      ?&gt;
  </code></pre>
  
  <p>Can you give me an idea on how to do it.</p>