jQuery load() function doesn't work

前端 未结 3 872
失恋的感觉
失恋的感觉 2021-01-17 01:48

I am new to the world of JavaScript and I\'m trying to use the function load() to insert another html file. It\' a little bit hard to explain, here is the code:



        
3条回答
  •  春和景丽
    2021-01-17 01:51

    Why it Doesn't Work

    Browser security restrictions can block you from using AJAX functions with content that is accessed through the file:// protocol (i.e. from a local file on your computer, without a web server).

    Solution

    I run a web server on my pc so that I can avoid all of these problems - back when I was working on a Windows PC, I used WAMP. These days, I use Linux (with Apache, PHP and MySQL) on my computer so I can work in an environment that is closer to the server.

提交回复
热议问题