<html>
<head>
<meta charset="utf-8"/>
<script src="js/jquery-1.10.2/jquery-1.10.2/jquery.js"></script>
<script type="text/javascript">
</script>
</head>
<body>
<script type="text/javascript">
function demo1(){
var result=1;
$.ajax({
url : '',
type : "get",
data : {},
async : true,
success : function(data) {
result = 2;
}
});
return result; //2
}
alert(demo1());
</script>
</body>
</html>