2

I have a dumb network device that has limited HTTP hosting capabilities and I'm trying to write a slightly more dynamic page to display data with. A some current process values can be found in plain-text at /temp.dat on the device, but my stone-simple jQuery script...

$(document).ready(function() {
     $('#temp').load('/temp.dat');
   var refreshId = setInterval(function() {
      $('#temp').load('/temp.dat');
   }, 2000);
   $.ajaxSetup({ cache: false });
});

...seems to endlessly fail (only after the first .load on the initial page load) because the device abhors HTML query parameters. Chrome's JS console shows endless errors like the following:

GET http://192.168.1.250/temp.dat?_=1341980712854  

How can I get jQuery (or pure JavaScript) to hammer away at a specific URL without attaching the HTML query (...?_=123456789)?

1
  • 5
    "Setting cache to false also appends a query string parameter, "_=[TIMESTAMP]", to the URL." api.jquery.com/jQuery.ajax Commented Jul 11, 2012 at 4:36

2 Answers 2

3

You should be able to add this at the top of the script

$.ajaxSetup ({
    cache: true
});
Sign up to request clarification or add additional context in comments.

Comments

0

when console outputs GET http://192.168.1.250/temp.dat?_=1341980712854, thats not an error, thats the log of the attempt to perform that task. When its colored red, it means that the HTTP GET of that particular address returned an error (like a 500).

1 Comment

Yes, but it's erroring out because it's attaching the query string (the ?_=...) which the device cannot handle. If that wasn't there, it shouldn't happen

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.