Studying the following ajax request, I was wondering:
- What advantages can a non-async ajax call achieve?
What is the
.responseMessagegood for, what does it store?var myTemplate = $.ajax({ type: "GET", url: "myurl.html", async: false, cache: false }).responseMessage;
Software Engineer
3,9861 gold badge28 silver badges35 bronze badges
asked Feb 16, 2014 at 13:27
user2952265
1,6309 gold badges24 silver badges35 bronze badges
-
1. google.com/…, 2. well the response of the AJAX call supposedly ...?C3roe– C3roe2014年02月16日 14:02:32 +00:00Commented Feb 16, 2014 at 14:02
1 Answer 1
Setting async to false means that the statement you are calling has to complete before the next statement in your function can be called. If you set async: true then that statement will begin it's execution and the next statement will be called regardless of whether the async statement has completed yet.
In your code the function will not continue execution until the ajax call is complete.
answered Feb 16, 2014 at 14:06
Chethan N
1,1581 gold badge10 silver badges24 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-js