I have the following code trying to get google url shortener to work.
$.ajax({
type: 'POST',
url: "https://www.googleapis.com/urlshortener/v1/url?key=AIzaSyDQ33gAu7thkpw_oW9VTcxR6YGhimcfik",
contentType: 'application/json',
data: '{ longUrl: "' + match +'"}',
dataType: 'jsonp',
success: function(id){
$('#menu').html(id);
}
});
The problem here is that when the data type is only json, the request is executed but nothing is returned. when it is changed to jsonp nothing happens at all. any ideas?
source
share