请求的资源上不存在“Access-Control-Allow-Origin”标头。 Origin'null'不允许访问。响应HTTP 401

时间:2015-10-23 00:19:02

标签: javascript json jsonp rpc json-rpc

var url = "http://www.api.sitehoover.com/api/";
var request = {};
request.id = "1";
request.method = "add_page";
request.params = "a7eede94cdc5e5aa77bd8db969ab0089";
request.params.folder_oid = "9";
request.params.url = "http://www.google.com/";
request.params.title = "My Google Page";
request.jsonrpc = "2.0";

function displaySearchResult(response) {
alert("In displaySearchResult.... ");
    if (response.result)
            alert(response.result);

    else if (response.error)
            alert("Search error: " + response.error.message);
};

$.post(url, JSON.stringify(request), displaySearchResult, "json");`

我正在尝试JSON RPC调用。当我检查Chrome控制台时,我发现: enter image description here

即使在Mozilla控制台中,它也会显示401授权错误。 当我开始挖掘这个错误时,我遇到了“单域策略”和其他引用添加标头以接受来自原始域的调用或使用 JSONP 解决问题的内容。

我也尝试了它们,但没有誓言。有人可以帮助JSONP吗?

0 个答案:

没有答案