I am doing quite lengthy asynchronous ajax GET request via JQuery (~120 MB, takes ~12s) and it is freezing UI.
To my limited understanding it should not be happening as it is asynchronous. I tried advices that I found on the net, like specifying "async: true".
Here is my simplified test code that I run locally in chrome and use " --user-data-dir --disable-web-security" key to do cross site request:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test.js</title>
</head>
<body>
<button id="b1">Button1</button>
<select>
<option value="test1">test1</option>
<option value="test2">test2</option>
<option value="test3">test3</option>
</select>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script>
function test(){
console.log("GET start");
$.ajax({
url: 'https://twitchemotes.com/api_cache/v3/subscriber.json',
method: 'GET',
async: true,
success: function () {
console.log("GET completed");
}
});
console.log("after GET");
}
$(document).ready(()=>{
$("#b1").click(test);
});
</script>
</body>
</html>
After pressing the button UI (e.g. select box) stops responding for the request time. It feels like browser is choking on accepting all the response data.
I saw a similar question, but the answer does not fit my environment.
Can someone, please, clarify why is this happening and what workarounds could there be.