So I have a Typepad blog and want to load some posts in to my own website. I looked at the Typepad API but it seemed overly complex. Typepad also supplies a widget, but that only shows post titles and hrefs and I need the content too.
So here's what I'm doing, I have jQuery included in the page:
$.ajax({
url: 'http://notes2self.typepad.com/notes/atom.xml?callback=?',
type: 'GET',
dataType: 'jsonp',
success: function(feed) {
console.log(feed);
},
error: function(err) {
console.log(err);
}
});
It logs "success" but the object logged looks like an XMLHttpRequest response where I want it to simply return the xml contents:
Object {readyState: 4, status: 200, statusText: "success"}
Also, in Chrome on OSX, the console logs an error on line 1 of atom.xml:
Uncaught SyntaxError: Unexpected token <
I'm obviously doing some very basic things wrong. Any tips to point me in the right direction?
I'm guessing here that the return type is invalid. If you go to http://notes2self.typepad.com/notes/atom.xml?callback=? then you'll get the results in XML (check the source).
Your jQuery is expecting a return type of JSON, and thus not able to parse the results. This is shown in the Chrome error message with the unexpected "<" character.
To prove this, try:
and see if there's any results coming back (feed).
This posts describes how to accomplish XML-based return types for cross-domain requests: http://www.isgoodstuff.com/2012/07/22/cross-domain-xml-using-jquery/