如图fruit4.html在同目录
花了数个小时寻找原因无法解决
看下发送网络请求没,返回的http状态码及内容
是否需要一个服务器?
确认下,你 当前页面目录下
是否有fruit4.html
这个文件。
必须在服务端运行
api的解释:
.load()
Load data from the server and place the returned HTML into the matched element.
你可以用$.get
试试。。
在电脑本地load是可以载入网页的,
我的页面如下:
主页面
![图片描述
被载入页面
最终浏览器中的结果
你那边失败可能的原因;
A. jquery没有成功载入: 可在load 前加个alert测试
alert('it works');
$(function (){ $('div').load('test.html') })
B. 文件路径的问题,
确定fuit4.html跟这个页面在一个文件夹内?
可以在head 中加上 <base>来明确路径
希望帮助你了