Skip to main content

Difference between synchronous and asynchronous XHR/fetch.

Entry JavaScript
Quick Answer Synchronous XHR blocks the main thread until the server responds รขโ‚ฌโ€ freezes the page. Asynchronous XHR/fetch is non-blocking รขโ‚ฌโ€ the code continues and a callback/Promise fires when the response arrives. Never use synchronous XHR in production. fetch() is the modern, Promise-based replacement for XHR รขโ‚ฌโ€ cleaner API and supports async/await.

Answer

Synchronous blocks the main thread; asynchronous uses callbacks/promises and does not block.

S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice