This is not using jQuery, but I'm used to do it like this:
doshit.php
<?php
if(isset($_POST['p1']) && isset($_POST['p2'])) {
echo $_POST['p1'] + $_POST['p2'];
}
?>
asd.html
<html>
<head>
<script>
function doit() {
var p1t = document.getElementById('p1');
var p2t = document.getElementById('p2');
var rest = document.getElementById('res');
var p1 = p11.value;
var p2 = p2t.value;
if(window.XMLHttpRequest) http=new XMLHttpRequest();
else http=new ActiveXObject("Microsoft.XMLHTTP");
http.onreadystatechange = function() {
if(http.readyState==4 && http.status==200) {
rest.value = http.responseText;
}
}
http.open("POST", "doshit.php", true);
http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
http.send("p1=" + p1 + "&p2=" + p2);
}
</script>
</head>
<body>
<input id='p1' type='text' />
<input id='p2' type='text' />
<input id='res' type='text' />
<input type='submit' value='Doit' onclick='doit(); />
</body>
</html>