I want to update my session variables on textbox's onchange event, without page reload How to do that.?? thanks!
4条回答 默认 最新
dongwei1921 2013-07-29 05:35关注I would use on
blur, that way it wont set the variable everytime the user types, only when he clicks somewhere else....$('textbox').blur(function(){ var thevalue = $(this).val(); $.ajax({ url:'yoururl.php', type: "post", data:{"value":thevalue}, dataType:"html", success:function(data){ console.log(data); } }); });THen in your php...
<?php $_SESSION['yoursessionkey'] = $_POST['value']; echo "success";?>
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报