Skip to content

Instantly share code, notes, and snippets.

@eunjae-lee
Created August 27, 2012 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eunjae-lee/3491069 to your computer and use it in GitHub Desktop.
Save eunjae-lee/3491069 to your computer and use it in GitHub Desktop.
Get WordPress Posts via XmlRcp from JavaScript
var wpService = new rpc.ServiceProxy("http://blahblah/xmlrpc.php", {
asynchronous: true,
protocol: "XML-RPC",
sanitize: false,
methods: ['wp.getPosts']
});
rpc.setDateRegexp(wpService, /^(\d\d\d\d)(\d\d)(\d\d)T(\d\d):(\d\d):(\d\d)$/);
wpService.wp.getPosts({
params: [
'1',
'username',
'password'
],
onSuccess: function (result) {
console.log('onSuccess', result);
},
onException: function () {
console.log('onException');
},
onComplete: function () {
console.log('onComplete');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment