Automatic usage of jsonp for cross domain ajax requests
<p>How can I tell jQuery to automatically use "jsonp" for cross-domain ajax requests while it keeps using "json" for same-domain requests? I want to write a client library in javascript which uses jsonp only when necessary. Let's take this small snippet as an example:</p>

<pre><code>jQuery.ajax(url, {
    dataType: "jsonp"
});
</code></pre>

<p>When data type is "jsonp" then jquery always uses jsonp but already automatically detects if it can send a normal Ajax request (for same-domain requests) or if it has to use javascript injection (for cross-domain request).</p>

<p>So it seems jQuery is already able to auto-detect this and decides which technique to use. But it is not necessary to use jsonp when a standard Ajax request is possible so I want to use "jsonp" only for cross-domain requests. How can I do this?</p>

<p>Or maybe it is possible to ask jQuery if a url is cross-domain or not? Then I could check this myself and call jQuery.ajax with different data types.</p>
