Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

jQuery: "async: false" with "beforeSend"

Avatar of ldbkutty
ldbkuttyFlag for India asked on
JavaScriptAJAXjQuery
4 Comments1 Solution14436 ViewsLast Modified:
Hi All,

The following code works good in Firefox, and displays the "Loading" image till there's a response. But the same does not show the "Loading" image in other browsers (IE, Safari).

I found somewhere that having both

async: false

and

beforeSend

doesn't go hand-in-hand. According to http://api.jquery.com/jQuery.ajax/#options : Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active.

Is there any workaround? Please advise.
var resp = $.ajax({
    url: myUrl,
    async: false,
    beforeSend: function () {
        jQuery('loading').show();
    },
    success: function(data, result) {
        jQuery('loading').hide();
    }
}).responseText;
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
ZvonkoFlag of North Macedonia imageSystems architect
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answers