Look this code:
看这段代码:
<input type="hidden" id="finalvalue" value="2" />
<script>
$.post("/increment_in_one", { param: 2 }, function (data) {
alert( data ); // this shows: 3
$("#finalvalue").val( data );
alert( $("#finalvalue").val() ); // this shows 3
});
alert( $("#finalvalue").val() ); // this shows 2
</script>
<input type="hidden"