Manual:CORS

The MediaWiki API supports cross-origin resource sharing if $wgCrossSiteAJAXdomains is enabled. This is used on Wikimedia sites to do things like allow image uploads

Some example code might look like: