ウェブAPIを介してデータベースにリクエストしようとしているウェブサイトがあります。 APIは基本的にビットフィールドを更新します(この場合は0から1)。(405)同じドメインとサーバー上のAPIとウェブサイトではメソッドが許可されていません
エラー:
これは、コンソールからすべてのです。
OPTIONS http://123.123.123.123:12345/project/webapi.svc/category/api/1/do/something 405 (Method Not Allowed)
send @ jquery-1.12.4.js:10254
ajax @ jquery-1.12.4.js:9738
click @ PageModal.js:10
(anonymous) @ jquery-ui.js:12443
dispatch @ jquery-1.12.4.js:5226
elemData.handle @ jquery-1.12.4.js:4878
XMLHttpRequest cannot load http://123.123.123.123:12345/project/webapi.svc/category/api/1/do/something. Response to page.aspx preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://123.123.123.123' is therefore not allowed access. The response had HTTP status code 405.
要求:私は、これは異なるドメインからAPIにアクセスしようとしている人々であるに見つけることができますが、私は同じドメインの午前
$.ajax({
type: 'POST',
contentType: "application/json; charset=utf-8",
url: "http://123.123.123.123:12345/project/webapi.svc/category/api/1/do/something", //method Name
data: JSON.stringify({ id: ticketId }),
dataType: 'json',
error: function (msg)
{
alert("error: " + msg.status);
}
});
唯一のもの。私も問題なくPOSTすることができるiOSアプリを持っているが、ウェブサイトに問題があるようだ。
質問:
私はこの405エラーを修正するにはどうすればよい?ここで何が起きてるの?
に投稿する権限を追加する必要があり、APIのバックエンドの問題だと思うがCORSに見て - それはあなたが抱えている問題です。 –
可能な複製http://stackoverflow.com/questions/20035101/no-access-control-allow-origin-header-is-present-on-the-requested-resource –
["No 'Access Control- Allow-Origin 'ヘッダーが要求されたリソースに存在する」」(http://stackoverflow.com/questions/20035101/no-access-control-allow-origin-header-is-present-on-the-requested-resource) –