??????ASP.NET MVC????????п??????Session?????????????????????Session?????????????????window.sessionStorage?????? AlexChittock??jQuery?????????????? https://github.com/AlexChittock/JQuery-Session-Plugin
???????????????
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Index</h2>
<input type="text" id="guess"/>
<br/>
<input type="button" id="btn" value="???"/>
@section scripts
{
<script src="~/Scripts/jquery.session.js"></script>
<script type="text/javascript">
$(function() {
//$.session.set('some key'?? 'a value');
//$.session.get('some key');
//$.session.clear();
//$.session.remove('some key');
$.session.set(mySessionKey?? "Hello World");
$('#btn').on("click"?? function() {
if ($('#guess').val() == $.session.get(mySessionKey)) {
alert("?????????~~");
}
});
});
var mySessionKey = "mykey";
</script>
}