$.getJSON not working with local JSON file

前端 未结 8 1092
野趣味
野趣味 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:35

    I think if you access the page that calls the getJSON with the IP address then use the ip address instead of localhost for the json file, effectively they belong to the same domain and it should work

    0 讨论(0)
  • 2021-01-15 09:36

    Chrome doesn't allow ajax calls to be made to local files. Refer This

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