首页 > 解决方案 > 跨域读取阻塞 (CORB) 问题是准确的,即使我使用 JSONP

问题描述

我正在使用 JSONP 进行跨域但问题未解决

<!DOCTYPE html>
<html>
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
    <p id="p1">this text should be changed,when the button is clicked</p>
    <div id="d1"></div>
    <div id="d2"></div>
    <div><img id="i1"></div>
    <button>click here</button>
</body>
</html>
<script>
    $(document).ready(function(){
        $("button").click(function(){
            $.ajax({
                url: "http://theoneinfotech.com/new_the_one/sp_api/master_tbl/get_body_type",
                dataType: "jsonp",
                type:'GET',
                success: function( response ) {
                    console.log( response ); // server response
                }
            });
        });
    });
</script>

api 工作正常,如果放在 Postman 或浏览器上但在这里不起作用(http://localhost/new)。如何解决它请帮助我。

提前致谢

问题是——

jquery.min.js:2 跨域读取阻止 (CORB) 阻止了跨域响应http://theoneinfotech.com/new_the_one/sp_api/master_tbl/get_body_type?callback=jQuery33104658196884971997_1548161549606&_=1548161549607与 MIME 类型 text/html。有关详细信息,请参阅https://www.chromestatus.com/feature/5629709824032768 。发送@jquery.min.js:2 ajax@jquery.min.js:2(匿名)@new:17 调度@jquery.min.js:2 y.handle@jquery.min.js:2

标签: javascriptjqueryjsonajaxjsonp

解决方案


推荐阅读