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.

    评论

报告相同问题?

悬赏问题

  • ¥15 Qt安装后运行不了,这是我电脑的问题吗
  • ¥15 数据量少可以用MK趋势分析吗
  • ¥15 使用VH6501干扰RTR位,CANoe上显示的错误帧不足32个就进入bus off快慢恢复,为什么?
  • ¥15 大智慧怎么编写一个选股程序
  • ¥100 python 调用 cgps 命令获取 实时位置信息
  • ¥15 两台交换机分别是trunk接口和access接口为何无法通信,通信过程是如何?
  • ¥15 C语言使用vscode编码错误
  • ¥15 用KSV5转成本时,如何不生成那笔中间凭证
  • ¥20 ensp怎么配置让PC1和PC2通讯上
  • ¥50 有没有适合匹配类似图中的运动规律的图像处理算法