我想通過使用twitter API獲取用戶信息。 jQuery的代碼如下:jquery ajax不工作
<script type="text/javascript">
function GetUser() {
$.ajax({
type: "GET",
url: "http://api.twitter.com/1/users/show.json?user_id=id&include_entities=true&callback=?",
contentType: "application/json; charset=utf-8",
dataType: "jsonp",
cache:true,
timeout:8000,
success: function (json) {
alert("Successfull");
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.responseText);
alert(thrownError);
}
});
}
</script>
xhr.responseText:未定義 thrownError:[對象錯誤] 和HTML代碼:
<input type="submit" value="Submit" onclick="GetUser();" />
這似乎是一個聲明,而不是一個問題。 – Barmar 2013-03-02 13:09:22
你有沒有包含jQuery? – 2013-03-02 13:09:51
你有沒有收到任何提醒訊息? – 2013-03-02 13:11:20