I am trying to pull in information from Asana API via JQuery.ajax() method. But no desired result is returned, or error showed.
Here is my partial code in JavaScript:
$(document).ready(function () {
$('#buttonCallAjax').click(function () {
jQuery.support.cors = true;
$.ajax(
{
type: "GET",
url: "https://app.asana.com/api/1.0/users/me",
data: "{}",
contentType: "application/x-www-form-urlencoded; charset=utf-8",
dataType: "jsonp",
success: function (data) {
alert(data);
},
error: function (msg, url, line) {
alert('error trapped in error: function(msg, url, line)');
alert('msg = ' + msg + ', url = ' + url + ', line = ' + line);
}
});
});
});
I have read a lot about ajax() method, but still figured out some options parameters in this method, like data, dataType(because this is cross-domain request, I used jsonp).
Can someone please help with successfully pulling in information from Asana API?