Manual:CORS

The main>Special:MyLanguage/API:Main page|MediaWiki API supports cross-origin resource sharing if   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).