是的,只需执行一个简单的AJAX请求即可。使用jQuery,它将是:
$("#formid").submit(function(){ $.ajax({ type: "POST", url: "someFileToUpdateTheSession.php", data: $(this).serialize(), success: function(){ // Do what you want to do when the session has been updated } }); return false;});而你的PHP:
<?php session_start(); $_SESSION["name"] = $_POST["name"]; // Add the rest of the post-variables to session-variables in the same manner?>
注意
您需要在输入字段中添加名称属性。



