According to jQuery :
crossDomain (default: false for same-domain requests, true for cross-domain requests)
Type: Boolean If you wish to f
If your are already specifying JSONP, then the crossDomain parameter doesn't do much. It just tells jQuery to ask for JSONP even if it's a local domain.
Let's say you are working on your machine with a local service that returns JSON or JSONP. You can use a plain $.ajax()
call, which works fine. In production however, the server redirects your request to a different domain if you meet some special conditions. Prod needs to ask for JSONP, because sometimes the response comes from off-domain.
Making that $.ajax()
call without crossDomain: true
or datatype: 'jsonp'
will assume the response can be plain JSON, so the code will fail in production.
You can also get cross-domain XML through prestidigitation like loading cross-domain XML through JSONP with YQL, which is really just wrapping it in JSONP.