javascript - Why does my ajax request report this error?
黄舟
黄舟 2017-05-19 10:29:57
0
3
482

jquery.js:8630 XMLHttpRequest cannot load file:///C:/Users/Yaphets/Desktop/text/data.json?callback=jQuery214005026997282902079_1493192403330&_=1493192403331. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.


$.ajax({ type:"GET", url:"data.json", dataType:"jsonp", success:function(data){ alert(data) }, });
黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all (3)
漂亮男人

If you want to simulate local JSON data, you need to deploy a server, such as apache. Your ajax also involves cross-domain. It is recommended to experiment in a real environment, or do not cross-domain for the time being. Just pass json first.

    滿天的星座

    dataType changed to json

      仅有的幸福

      You need a web server.

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!