3

I am calling a third party webservice using getJSON callback. The function does not have a success handler attached to the function and since it is third party, I cannot edit the code also. By the time I receive the response, some of the javascript function in the page already executes.

Is there any way I can delay the execution of the Javascript function till I receive the response data from web service except setTimeout method.

0

2 Answers 2

3

Description

You can use jQuery's .ajaxStart() and .ajaxComplete() events to get noticed if your ajax call is running. You can create a bool variable, something like isAjaxRunning and put this around the other javascript. So if isAjaxRunning is true, dont execute other javascript.

More Information

Sign up to request clarification or add additional context in comments.

Comments

1

if you have access to the code you can make it synchonize by adding the attribute

async : false - then it won't be a asynchronous call like the normal ajax .

If you can post the sample code - that will give a clear picture.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.