JQuery Ajax请求http://pastebin.com/raw.php

时间:2013-05-08 20:20:39

标签: javascript jquery ajax pastebin

我尝试向'http://pastebin.com/raw.php'发出JQuery ajax请求并使用以下代码:

$.ajax({
        url: 'http://pastebin.com/raw.php',
        data: "i=VJ29uFnk",
        complete: function(jqXHR, textStatus) {
            alert('complete');
        },
        success: function(data) {
            alert(data);
        },
        error: function(xhr, status, error) {
            alert('noh!')
        }
});

有了这个,我在xhr中获得了一个'404'状态,但是我在firebug中看到的url看起来是正确的:

http://pastebin.com/raw.php?i=VJ29uFnk

想法?

2 个答案:

答案 0 :(得分:1)

XHR调用受Same origin policy

保护

然而,你可以做的是调用绕过它的服务器端脚本。

答案 1 :(得分:1)

您可以通过创建捕获所需数据的PHP脚本来规避相同的原始策略:example.com/getpage.php?url=pastebin.com/raw.php?i=VJ29uFnK