1

All,

I have a need to make cross-domain AJAX requests and hence added "$.support.cors = true;" line before my ajax requests.

But for non cross-domain calls, my ajax doesn't seem to hit.

Does this "$.support.cors = true;" has impact on the non cross-browser calls or am i seeing something wrong?

Any help is much appreciated! Thanks

Jegan Kunniya
  • 986
  • 3
  • 17
  • 27
  • You'll get a better response if you define "doesn't seem to hit". Do you get errors? Does the response actually get loaded (check the network tab in your console)? What's the actual problem you're encountering? – nrabinowitz Mar 06 '13 at 18:13
  • setting $.support.cors to true doesn't do anything other than trick jQuery into thinking that all browsers fully support CORS, which is not true. IE < 10 does not support CORS in the same way that the other browsers do, therefore CORS will not work in IE< 10 in jQuery unless you extend jQuery. – Kevin B Mar 06 '13 at 18:19
  • The only time you should use `$.support.cors = true` is if you're using an environment where cors is supported but jQuery incorrectly detects that it isn't, such as phonegap. – Kevin B Mar 06 '13 at 18:26
  • @nrabinowitz, "doesn't seem to hit" means, that the request doesn't happen to the server. But the error might have been missed as I was not caching it till i read your comment. – Jegan Kunniya Mar 06 '13 at 18:58

1 Answers1

3

As others have said, jQuery should detect CORS requests appropriately by default. Sounds like you should not set $.support.cors. The problem you are probably running into, without setting that, may be one of the following:

Community
  • 1
  • 1
Andrew Mao
  • 35,740
  • 23
  • 143
  • 224
  • Just commented this elsewhere, but it should be noted that the MoonScript does not support cross protocol calls. – Jason D. Oct 08 '15 at 15:51