Skip to content

Instantly share code, notes, and snippets.

@cymen
Created April 25, 2014 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cymen/11300440 to your computer and use it in GitHub Desktop.
Save cymen/11300440 to your computer and use it in GitHub Desktop.
CORS: Getty Connect API and jQuery POST SearchForImages example
$.ajax({
url: 'https://connect.gettyimages.com/v2/search/SearchForImages',
type: 'POST',
crossDomain: true,
dataType: 'json',
contentType: 'application/json',
data: JSON.stringify({
RequestHeader: {
Token: '__YOUR_TOKEN_HERE__'
},
SearchForImagesRequestBody: {
Query: {
SearchPhrase: 'fish'
},
ResultOptions: {
ItemCount: 10,
ItemStartNumber: 1
}
}
}),
success: function(data, textStatus, jqXHR) {
console.log('success');
console.log(arguments);
console.log(data);
},
error: function() {
console.log('error');
console.log(arguments);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment