Question

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?

Was it helpful?

Solution

XHR calls are protected under the Same origin policy.

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top