$.getJSON not working with local JSON file

前端 未结 8 1098
野趣味
野趣味 2021-01-15 08:56

I am desperately trying to get a local build of a site to get a JSON file (also local) with no luck. The exact code worked perfect on my server, but once local, breaks.

8条回答
  •  不思量自难忘°
    2021-01-15 09:23

    XmlHttpRequest isn't allowed cross-domain.

    If you need to do a demonstration on a local pc, setup your web app to run on local webserver, and have the json source be returned be the same web application.

    That's the only way I can think to make it work. You can't use Ajax calls on filesystem for security reasons.

提交回复
热议问题