I’m using Math.random to generate a random string passed in an ajax call. The problem is that the string generated contains a decimal, and the server interprets this as a file.ext (which of course doesn’t exist).
Ex from http.log:
File does not exist: /path/to/site/foo.php&arg=123&randval=0.5678719817071954, referer: http://site/bar.php?arg=123
Ajax used to generate link:
$(document).ready(function()
{
$(\"#placeholder\").load(\"/foo.php?arg=123\");
var refreshId = setInterval(function()
{
$(\"#placeholder\").load('/foo.php?arg=123&randval='+ Math.random());
}, 5000);
$.ajaxSetup({ cache: false });
});
What I’d like to end up with is:
foo.php&arg=123&randval=05678719817071954
The argument randval is not used other than to ensure I don’t wind up with a cached version of the page. It may not be needed, but this is from an example I used to set up the jquery ajax call.
I’d suggest, in place of
Math.random(), using: