weixin_33699914 2015-11-29 12:40 采纳率: 0%
浏览 23

错误消息仅显示“错误”

It's been a while I've been doing jQuery, so this might be a very basic question. I've done the following call.

$.ajax({
  url: "http://www.google.com",
  success: function () { alert("hazaa"); },
  error: function(xhr, status, error) {
    $("#donkey").html(xhr.responseText + status + error);
  },
  type: "GET"
});

It gets executed but my donkey only shows the text error (status part, that is, while xhr and error are blank). I've tried to go eval on it but that caused an exception and nothing got done.

I've heard about this google site and it definitely is up and running, hehe. What did I miss?!

  • 写回答

1条回答 默认 最新

  • weixin_33735077 2015-11-29 12:44
    关注

    You can't access Google via AJAX because of the Same-Origin-Policy. See the "different host" example here.

    评论

报告相同问题?