-1

次のコードの実行中に、CORS エラーが発生し、「FAIL」としてアラートが発生します。失敗せずに成功させるために何をすべきか。提案してください。

<!DOCTYPE html>
<html>
    <head>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    </head>
    <body>XML Data Load Test</body>
    <script>
        $(function() {
            $.ajax({
                type: "GET" ,
                url: 'https://www.w3schools.com/xml/plant_catalog.xml',
                dataType: "xml" ,
                success: function() {
                     alert("Success");
                },
                error: function() {
                        alert('Fail');
                }       
            });
        });
    </script>
</html>

「FAIL」としてエラーとアラートを取得する

4

1 に答える 1