Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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>
Posted
Updated 13-Aug-13 16:39pm
v5
Comments
virusstorm 14-Aug-13 14:44pm    
I suggest running a utility called Fiddler to inspect the HTTP traffic between your computer and the client. It sounds like a networking issue.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900