I have a Chatter Communities API request that creates a new user profile picture. This API callout works when I use an app like Ruby or even a cURL command. However, using an AJAX callout, I get a CORS issue.
I have implemented the CORS functionality as outlined in the Chatter REST docs, but still receive the CORS issue.
Here is my jQuery code:
$.get('/photo-upload-url', function(params) {
//assume nothing exploded
//build the sf request
$.ajax({
url: params.url,
type: 'POST',
data: data,
headers: {
Authorization: 'Bearer ' + params.token
},
crossDomain: true,
processData: false,
success: function(ret) {
console.info(data);
uploading = false;
}
});
});