The following code allows you to process code from a separate PHP page, then dynamically insert the result into the current page using jQuery.  The example below uses a very basic form, extracts the form fields and passes them to a PHP page.  The PHP page could do any calculations or manipulations then output the result.  The result is captured and inserted into the existing page without ever having to reload the page.  Note: This is not a secure setup.  You'd want to make sure you PHP page only outputs secure code to avoid XSS attacks.  Review this link for more information.

{codecitation class="brush:html"}

<script type='text/javascript' src=''></script>

<script type="text/javascript">
               url: "page2.php?s=" + parseInt($("#start").val()) +
                       "&c=" + $("#color").val() +
                       "&n=" + $("#name").val() +
                       "&dn=" + parseFloat($("#dn").val()),
               cache: false,
               success: function(html){

<form >
<select id="start" name ="start">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
<select id="color" name="color">
    <option value="red">red</option>
    <option value="blue">blue</option>
    <option value="green">green</option>
<br /><br />
Name: <input type="text" name="name" id="name"  />
<br /><br />
Some Decimal Number <input type="text" name="dn" id="dn"  />
<br /><br />
<button id="opener" onclick="return false">Do It</button>

<div id="result">


{codecitation class="brush:php"}


echo $_GET['s'] . '<br />';
echo $_GET['c'] . '<br />';
echo $_GET['n'] . '<br />';
echo $_GET['dn'] . '<br />';