Skip to main content

Explain cross-domain AJAX requests in jQuery.

Mid JQuery
Quick Answer By default, browsers block cross-domain AJAX (Same-Origin Policy). Solutions: server must send CORS headers (Access-Control-Allow-Origin). For jQuery JSONP (legacy): dataType: "jsonp" in $.ajax - works by injecting a script tag, not true AJAX. Modern solution: configure CORS on the server and use standard $.ajax with JSON. JSONP only supports GET and is insecure.

Answer

Same-origin policy blocks external requests.
Solutions:
• CORS enabled by server
• JSONP for GET requests
Allows safe cross-domain communication.
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