使用jQuery的$ .get时出错我得不到.

Mik*_*e_G 1 javascript jquery

这很简单:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title></title>

<script src="jquery.js" type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function() {
        $.get("http://twitter.com/statuses/user_timeline/19092829.rss");
    });
</script>
</head>
<body>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

在IE和Opera中,这非常有效,但在FF 3.5,Chrome和Safari中我得到了400 Bad Request.使用Fiddler2和FireBug查看请求,有些东西正在用OPTIONS替换GET.但在IE和Opera中,它仍然显示为GET.我不明白????

编辑:我觉得这样的白痴甚至没有考虑XSS政策.多谢你们.

Sam*_*son 5

你不能从另一个域$ .get().安全问题.

您可以在服务器上浏览代理脚本.您可以使用PHP或C#(.NET)为您获取数据并将其返回到您的jQuery脚本.