Mashape Blog

Rumors aboard Mashape's spaceship

Chris Ismael
This sample code snippet below is CORS-enabled so you don’t have to worry about cross-domain requests. $.ajax({ 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 } }); Source: