I am working with wordpress xmlrpc javascript api, a neat javascript api for accessing wordpress's xmlrpc api from javascript.
The problem I have is, after wp.editPost
returns true
, the post content is simply blank!
This is my relevant code:
var wp = new WordPress(blog, username, password);
var blogId = 1;
var object = wp.getPost(blogId, postId);
// alert(JSON.stringify(object));
var currentContent = object.post_content;
alert(currentContent); // works fine
var newContent = currentContent.replace('</ul>', strToInsert + '</ul>')
alert(newContent); // works, and it is what I want the content to be after editing
object = wp.editPost(blogId, postId, {post_content:newContent});
alert(JSON.stringify(object)); // works, alerts true
Now, refreshing my page, the changes do not take place, but instead my content becomes empty now.
Any idea what is wrong? I am sure it has to be something with wordpress. I could look into it but I was wondering if any of you had similar problem too!
Note: I refresh the page while I was logged in. Does this matter anyhow?