google url shortener api and jquery not working

Posted by rahim on Stack Overflow See other posts from Stack Overflow or by rahim
Published on 2011-01-14T03:51:01Z Indexed on 2011/01/14 3:53 UTC
Read the original article Hit count: 335

Filed under:
|
|
|

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"
   });

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX