Last Updated: July 19, 2020
·
1.157K
· gianttoast

Enabling cross domain requests in jQuery

jQuery 1.5 and up does not support cross domain requests by default (for good reason). This can be problematic when you are trying to test something that has to make ajax calls to external web services. So if you are wondering why your $.ajax calls keep failing, try adding this little snippet to the top of your javascript file:

jQuery.support.cors = true;

Hope that helps someone, it caused me quite the headache the other day.

1 Response
Add your response

you can also set crossDomain property to true

over 1 year ago ·