Wikipedia:WikiProject User scripts/Guide/Ajax: Difference between revisions
Content deleted Content added
→Get the wikitext of a page: -superfluous " action: 'query', "; +formatting |
→Edit a page and other common actions: Use promises! |
||
Line 100:
summary: info.summary,
token: mw.user.tokens.get( 'editToken' )
},▼
success: function( data ) {▼
if ( data && data.edit && data.edit.result && data.edit.result == 'Success' ) {▼
alert( 'Page edited!' );▼
} else {▼
alert( 'The edit query returned an error. =(' );▼
error: function() {▼
alert( 'The ajax request failed.' );▼
}
})
})
});
}
|