I want to seperate thread on the page to prevent freezing of gui. For this, I am running the function which will freeze gui inside another thread with setTimeout but still freezing.
The code and jsbin link are below:
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"
type="text/javascript"></script>
<meta charset="utf-8" />
</head>
<body>
<div id="div1"></div>
<div id="div2"></div>
<input type="button" value="düðme" id="btn" />
<script type="text/javascript">
$("#btn").on("click",function(){
$("#div1").html(new Date());
});
$(document).ready(function(){
setTimeout(function() { count(); },1);
});
function count(){
for(var i =0;i<100000;i++){
$("#div2").html(i);
}
$("#div2").append(new Date());
}
</script>
</body>
</html>

async: true. I'm now searching to find good info about webworkers. I need to run something in other threads while gui still touchable and loading another data from network.async:truewill just mean that browser can spend some time dealing with other tasks while it waits for ajax call results.