It's a general question, so here's a general answer and in pretty much the simplest terms -
On the sending page (some.htm):
Code:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript">
jQuery(function($){
$('#mybut').click(function(){
jQuery.ajax({
url: 'process.php',
type: 'POST',
data: 'picnum=' + ($('#picnum').val() || 0),
success: function(result){
alert(result);
}
});
});
});
</script>
</head>
<body>
Pick a Number, Any Number: <input type="text" id="picnum">
<input type="button" id="mybut" value="Go!">
</body>
</html>
On the receiving page (process.php):
PHP Code:
<?php
$picnum = isset($_POST['picnum'])? $_POST['picnum'] : 0;
echo "The picnum was set to $picnum.";
?>
Obviously you could do a lot more on either or both pages depending upon your objectives.
Bookmarks