asimryu

jquery prevent cache(2015.06.17) 1

Jun 16th, 2015
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.72 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="ko">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Document</title>
  6. <script src="./js/jquery-1.11.3.min.js"></script>
  7. <script>$.ajaxSetup({ cache: false });</script>
  8. </head>
  9. <body>
  10. <button class="open" data-url="1.php">불러오기1</button>
  11. <button class="open" data-url="2.html">불러오기2</button>
  12. <button class="open" data-url="3.html">불러오기3</button>
  13. <button class="open" data-url="4.html">불러오기4</button>
  14. <div id="content"></div>
  15. <script>
  16.     $(function(){
  17.         $(".open").click(function(){
  18.             var url = $( this ).attr( "data-url" );
  19.             if( ! url ) return;
  20.             url = url + "?" + (new Date()).getTime();
  21.             $( "#content" ).load( url );
  22.         });
  23.     });
  24. </script>
  25. </body>
  26. </html>
Advertisement
Add Comment
Please, Sign In to add comment