HTML资源未找到,加载资源失败:服务器响应状态为404(未找到)

我正在关注有关Javascript和Ajax的Lynda教程,并在主题为“使用同步XHR请求”的主题上挂起了这个问题。加载资源失败:服务器响应状态为404(未找到)

基本上HTML文件是:

JavaScript AJAX

和JavaScript文件是:

var request = new XMLHttpRequest();

request.open('GET', 'data.txt', false);

request.send();

console.log(request);

data.txt文件具有的 “Hello World” 就可以了。

路径到项目文件

C:/wamp/www/ajax/index.html

C:/wamp/www/ajax/script.js

当我打开wampserver本地主机,并做检查元素我得到这个上面的错误说“无法加载资源:服务器用状态404(未回应找到)“

主线程上的同步XMLHttpRequest已弃用,因为它对最终用户的体验有不利影响。如需更多帮助,请查询http://xhr.spec.whatwg.org/。 http://localhost/ajax/script.js无法加载资源:服务器与404状态(未找到)

的XMLHttpRequest

onabort: null

onerror: null

onload: null

onloadend: null

onloadstart: null

onprogress: null

onreadystatechange: null

ontimeout: null

readyState: 4

response: "↵

↵404 Not Found↵↵

Not Found

The requested URL /ajax/data.txt was not found on this server.


Apache/2.4.9 (Win32) PHP/5.5.12 Server at localhost Port 80
↵↵"

responseText: "↵

↵404 Not Found↵↵

Not Found

The requested URL /ajax/data.txt was not found on this server.


Apache/2.4.9 (Win32) PHP/5.5.12 Server at localhost Port 80
↵↵"

responseType: ""

responseURL: "http://localhost/ajax/data.txt"

responseXML: null

status: 404

statusText: "Not Found"

timeout: 0

upload: XMLHttpRequestUpload

withCredentials: false

__proto__: XMLHttpRequest

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值