Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery ajax with async false hangs firefox

I have a code that calls $.ajax like this :

$.ajax({

                        type: "POST",
                        url: "/sandbox/graphloader/mock3",
                        async: false,
                        data: {calInput1:dates[0], calInput2:dates[1]},
                        success: function(data){
                            data=eval(data);
                            for(var x in data[0]){
                                //alert(data[0][x]);
                                //fill columns here;
                            }

                            fillPercents(column);
                        }});

now, this works in all browsers, other than Firefox. firebug shows it is getting reply back from post, but for some unknown error, it is not displaying the data. What might be the problem ?

like image 933
Shrinath Avatar asked Dec 13 '22 18:12

Shrinath


1 Answers

This behavior is by design.

Never use async: false.
Since Javascript runs on the UI thread, an async: false request will freeze the browser until the server replies.

like image 98
SLaks Avatar answered Jan 01 '23 10:01

SLaks