无法加载资源:服务器响应状态为412(前提条件失败) [英] Failed to load resource: the server responded with a status of 412 (Precondition Failed)
问题描述
我收到以下错误
无法加载资源:服务器响应状态为412(前提条件失败)
当我尝试使用`$ .post`从文本文件中获取数据时
首次尝试网页工作正常并且数据从文件,但当我刷新时,它有时不加载。当我删除缓存并再次尝试它已成功加载。但我仍然认为这个问题不是因为只有缓存。第一次加载页面错误是在JS控制台中显示。我正在使用谷歌浏览器。
I am getting following error
Failed to load resource: the server responded with a status of 412 (Precondition Failed)
while I try to fetch data from a text file using `$.post`
On first try web page works fine and data is loaded from file but when I refresh it is not loaded sometimes.When I deleted cache and try again it was loaded successfully.But still I think this problem is not because of cache only.First time when I loaded the page error was there showing in JS console.I am using Google Chrome.
<body>
<div onclick="fetch_data()">click me</div>
<h1 class="result"></h1>
</body>
<script type="text/javascript">
function fetch_data()
{
$.post('sometext.txt', function(data)
{
$('.result').html(data);
});
}
</script>
推荐答案
.post`
第一次尝试网页工作正常,数据加载从文件,但当我刷新它有时不加载。当我删除缓存并再次尝试它已成功加载。但我仍然认为这个问题不是因为只有缓存。第一次当我加载页面错误是在JS中显示我正在使用谷歌浏览器。
.post`
On first try web page works fine and data is loaded from file but when I refresh it is not loaded sometimes.When I deleted cache and try again it was loaded successfully.But still I think this problem is not because of cache only.First time when I loaded the page error was there showing in JS console.I am using Google Chrome.
<body>
<div onclick="fetch_data()">click me</div>
<h1 class="result"></h1>
</body>
<script type="text/javascript">
function fetch_data()
{
.post('sometext.txt',function(data)
{
.post('sometext.txt', function(data) {
('。result')。html(data);
});
}
< / script>
('.result').html(data); }); } </script>
这篇关于无法加载资源:服务器响应状态为412(前提条件失败)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!