[removed] can't load JSON file from localhost

前端 未结 1 1493
长发绾君心
长发绾君心 2020-12-21 16:13

I\'m currently working through the book \"Head first HTML5 programming\". I want to load the content of a file named sales.json from a web server on my own mach

相关标签:
1条回答
  • 2020-12-21 16:53

    I open html document with firefox

    Your HTML document must be open with a URL in http://, not file://, if you want it to be able to open in javascript another document, unless the second document is served with relevant CORS headers.

    This is due to same origin policy.

    As you have a local WAMP server, there is no problem : simply open your file using a http:// URL like you do for your JSON file.

    0 讨论(0)
提交回复
热议问题