Last active

Embed URL


SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Sample code for executing an AJAX request using jQuery.

View CorsRequest.js
1 2 3 4 5 6 7 8 9 10 11
url: 'MASHAPE-URL', // The URL to the API. You can get this by clicking on "Show CURL example" from an API profile
type: 'POST', // The HTTP Method
data: {}, // Additional parameters here
datatype: 'json',
success: function(data) { alert(JSON.stringify(data)); },
error: function(err) { alert(err); },
beforeSend: function(xhr) {
xhr.setRequestHeader("X-Mashape-Authorization", "YOUR-MASHAPE-KEY"); // Enter here your Mashape key

Thanks for this! By the way, the second "t" in your "dataType" parameter is lowercase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.