I am trying to make an jQuery ajax request to AWS S3 to list bucket objects. Since AWS only wants to respond with XML, I am having trouble using (or going around) the data type JSONP.
$.ajax({
method: 'GET',
url: "http://BUCKET.s3.amazonaws.com/?querystring", // returns xml
dataType: 'jsonp',
// dataType: 'jsonp xml',
success: function(data) {
console.log('success', data);
},
error: function(err) {
console.log('err', err);
}
}).done(function(data) {
console.log('finished', data);
});
Gives error Uncaught SyntaxError: Unexpected token <
because it is receiving XML instead of JSON.
I understand that cross domain requests are blocked by default, so I'd normally use JSONP. However that gives me a syntax error when returning xml, and I'm not sure how to convert from xml to json before that point. In the ajax request I tried converting dataType with "jsonp xml", but really don't I want to be doing xml->json? Which gives an error as it is expecting json first.
I've checked out these other questions but am still having trouble, any help would be greatly appreciated.
edit: also this is a static html site.