google url shortener api and jquery not working
- by rahim
i cant seem to get google's new url shortener api to work with jquery's post method:
$(document).ready(function() {
$.post("https://www.googleapis.com/urlshortener/v1/url", { longUrl: "http://www.google.com/"},
function(data){
console.log("data" + data);
});
$('body').ajaxError(function(e, xhr, settings, exception) {
$(this).text('fail'+e);
console.log(exception);
});
});
all of this gives me an empty (data) response AND an empty (exception) response. any ideas?
ive also tried this with no success:
$.ajax({
type: 'POST',
url: "https://www.googleapis.com/urlshortener/v1/url",
data: { longUrl: "http://www.google.com/"},
success: success,
dataType: "jsonp"
});