Advertisement
Guest User

CF11 Session Replication Test

a guest
May 8th, 2015
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <head>
  3.     <title>Session sharing test</title>
  4. </head>
  5. <body>
  6.     <h2>Page Request</h2>
  7.     <cflock timeout="1" scope="Session" type="readonly">
  8.         <cfdump var="#session#" />
  9.     </cflock>
  10.    
  11.     <h2>AJAX Calls</h2>
  12.     <div id="aget"></div>
  13.    
  14.     <script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
  15.     <script>
  16.        
  17.         var count = 0;
  18.         var MAX_CALLS = 100;
  19.         var INTERVAL = 5000;
  20.                
  21.         function doGet() {
  22.             count++;
  23.             $.get('test.cfc', {
  24.                 method: 'test'
  25.             }, function(data){
  26.                 $('#aget').append('<div>' + data + ' (GET)</div>');
  27.                 if (count < MAX_CALLS) setTimeout(doCalls,INTERVAL);
  28.             });
  29.         }
  30.        
  31.         function doPost() {
  32.             count++;
  33.             $.post('test.cfc', {
  34.                 method: 'test'
  35.             }, function(data){
  36.                 $('#aget').append('<div>' + data + ' (POST)</div>');
  37.                 if (count < MAX_CALLS) setTimeout(doCalls,INTERVAL);
  38.             });
  39.         }
  40.        
  41.         function doCalls() {
  42.             if (count%2) doGet();
  43.             else doPost();
  44.         }
  45.        
  46.         $(function(){
  47.             doCalls();         
  48.         });    
  49.        
  50.     </script>
  51. </body>
  52. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement