My index.php code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script src="js/jquery.js"></script>
<script>
$(function(){
$("body").load("AJAX.php");
});</script></head>
<body>
</body>
</html>
And my AJAX.php code
<body>
<script src="js/asdf.js"></script>
</body>
and my asdf.js code
function cool(){
alert("hi");}
Now When i load index.php and see the console it output
[16:21:57.237] GET http://localhost/js/asdf.js?_=1342003917230 [HTTP/1.1 200 OK 8ms]
Now i want to know why it is adding that random number to url of js file and how to prevent that?
It is added to prevent the file from being served from browser cache.
If you are using the .load method in jQuery you can disable it by passing the option
{cache:false}Or