Skip to content

Instantly share code, notes, and snippets.

@slaporte
Created May 8, 2012 20:26
Show Gist options
  • Save slaporte/2639006 to your computer and use it in GitHub Desktop.
Save slaporte/2639006 to your computer and use it in GitHub Desktop.
WP anon api edits
var sendData = {
action: 'edit',
format: 'json',
title: 'User:Slaporte/sandbox',
text: 'test',
summary: 'test',
token: '+\\'
};
$.ajax({
url: 'http://en.wikipedia.org/w/api.php',
data: sendData,
dataType: 'json',
type: 'POST',
success: function( data ) {
if ( data.edit.result == "Success" ) {
'Yes!!'
} else {
console.debug( 'Unknown result from API.' );
}
},
error: function( xhr ) {
console.debug( 'Edit failed.' );
console.debug( xhr.responseText );
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment