문제

I try to make a JQuery ajax request to 'http://pastebin.com/raw.php' and using this code:

$.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!')
        }
});

With this I get a status '404' within xhr but the url I can see in firebug looks correct:

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

Ideas?

도움이 되었습니까?

해결책

XHR calls are protected under the Same origin policy.

What you can do, however, is call a server side script that bypass this.

다른 팁

You could circumvent the same origin policy by creating a php script that captured the data you want: example.com/getpage.php?url=pastebin.com/raw.php?i=VJ29uFnK.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top