I have a dynamic page where the user can fill in some fields. These users will have a WordPress blog account. I would like to allow them to directly post content created by the webpage to the blog. I do not want to store my password on the server, so I want to do this on the client side using jQuery.
I looked at both the standard jQuery.post and the rpc plugin , but I was not able to get them to work. For example, my last attempts were something like this:
wprpc = $.rpc('http://blog.wordpress.com/xmlrpc.php', 'xml', callback);
function callback(server) {
answer = server.newPost(0,'user','pass','<struct><title>TestRPC</title></struct>');
alert(answer);
}
and desperate:
$.post('http://blogurl.com/xmlrpc.php', { blogid: 0, username: "user", password: "pass", struct: "<struct><title>Test</title></struct>" }, function(data) {alert(data);}, 'xml');
but he was silent (callback is not even called).
How do you do this?
source
share