【发布时间】:2011-08-19 22:43:00
【问题描述】:
我有以下代码,试图让谷歌的 URL 缩短器工作。
$.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);
}
});
这里的问题是,当数据类型只是 json 时,发出了请求,但没有返回任何内容。当它更改为 jsonp 时,什么也没有发生。有什么想法吗?
【问题讨论】: