Kira
Kira

Reputation: 91

Greasemonkey, Cross domain, jQuery, get() request failing with 405 "method not allowed"

I am making cross domain jQuery get() and it failing with a "405 not allowed" error.

My Greasemonkey script is something like this:

// ==UserScript==
// @include        http://www.foobar.com/*
// ==/UserScript==

var query = "www.foobar.com";
 $.get(
        url,
            function(response){
                alert(response);
            },
            "xml"
    );

Any pointers will be highly appreciated.

Upvotes: 2

Views: 5137

Answers (1)

Brock Adams
Brock Adams

Reputation: 93473

get() and other jQuery AJAX functions do not work cross-domain, by design. (It was/would-be a huge security hole, if they did.)

Use GM_xmlhttpRequest() instead, it does allow cross-domain AJAX.

Upvotes: 4

Related Questions