私はウェブサイトを持っており、プッシュパッドを使いたいです。すべて正常に動作しますが、私はサブスクリプションの数を表示したいと思います。サイトでは、REST APIを使用する必要があると言いますが、以前はajaxを使用していませんでした。このプッシュパッドのスクリプトが動作しないのはなぜですか
$.ajax({
type:"GET",
contentType: "application/json",
beforeSend: function (request)
{
request.setRequestHeader("Accept", "application/json");
request.setRequestHeader("Authorization", "Token token='mytoken'");
},
crossDomain: true,
dataType: 'json',
url: "https://pushpad.xyz/projects/projectid/subscriptions",
success: function(msg) {
alert("success");
}
});
このコードは、エラーを与える:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
私はPをJSONにデータ型を変更した場合、私は別のエラーが出る:
Refused to execute script from 'currectURL' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
私はしばらくの間、検索が、私は」didnの関連する質問が見つからないので、私があなたを助けてくれることを願っています。