Wikipedia:WikiProject User scripts/Guide/Ajax: Difference between revisions

Content deleted Content added
Get the wikitext of a page: -superfluous " action: 'query', "; +formatting
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.' );
}
})
success: .done (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: .fail ( function() {
alert( 'The ajax request failed.' );
});
}