내 index.php에 코드임의의 숫자 자동으로 JS 파일
<!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>
그리고 내 AJAX.php 코드
<body>
<script src="js/asdf.js"></script>
</body>
내 asdf.js 코드에 추가
function cool(){
alert("hi");}
이제 index.php를로드하고 출력되는 콘솔을 볼 때
[16:21:57.237] GET http://localhost/js/asdf.js?_=1342003917230 [HTTP/1.1 200 OK 8ms]
이제 js 파일의 URL에 왜 그 난수를 추가하는지, 어떻게 방지 할 수 있는지 알고 싶습니다.
그 행을 어디에 둘 것인지 {cache : false} –
사용할 수 있습니다 '$ .ajaxSetup'은 전역 적으로 캐싱을 가능하게합니다. 그렇지 않으면'$ .ajax'를 사용해야합니다. –
캐시 : true is right –