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 directly to Commons from Wikipedia sites on the mobile interface.

Some example code might look like:

For a basic editing example, see here (should work on Wikimedia sites).