S
S
Shamil Khairulaev2021-10-20 22:05:10
AJAX
Shamil Khairulaev, 2021-10-20 22:05:10

How to solve the problem (The error code is too long to paste here, I will paste it in detail)?

Refused to connect to ' https://www.script-shdbd.com/yandex_data_to_excel.php ' because it violates the following Content Security Policy directive: "connect-src 'self' data: blob: wss://push.yandex. ru wss://*.ldev.yandex.ru yandex.ru yandex.ua yandex.com *.yandex.ru *.yandex.ua *.yandex.com *.yandex.net yastatic.net yastat.net yandex.st *.yandex-team.ru *.adfox.ru tps.doubleverify.com pixel.adsafeprotected.com mc.yandex.az mc.yandex.by mc.yandex.co.il mc.yandex.com.am mc.yandex. com.ge mc.yandex.com.tr mc.yandex.ee mc.yandex.fr mc.yandex.kg mc.yandex.kz mc.yandex.lt mc.yandex.lv mc.yandex.md mc.yandex.tj mc.yandex.tm mc.yandex.uz mc.webvisor.com mc.webvisor.org mc.admetrica.ru yandexmetrica.com:*".

It appears when I send ajax via the 'User javascript and CSS' plugin to my script.

ajax request code:

$.ajax({
    type: 'POST',
    url: 'https://www.script-shdbd.com/yandex_data_to_excel.php',
    data: {
        name: name,
        address: address,
        phone: phone,
        url_addr: url_addr
    }
}).done(function (data) {
  alert(data)
});


The php code where the request comes in:
<?php 
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT");
header("Access-Control-Max-Age: 0");
header("Content-Security-Policy: default-src *; connect-src *; script-src *; object-src *;");
header("X-Content-Security-Policy: default-src *; connect-src *; script-src *; object-src *;");
header("X-Webkit-CSP: default-src *; connect-src *; script-src 'unsafe-inline' 'unsafe-eval' *; object-src *;");
print_r($_POST);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question