Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Session sharing test</title>
- </head>
- <body>
- <h2>Page Request</h2>
- <cflock timeout="1" scope="Session" type="readonly">
- <cfdump var="#session#" />
- </cflock>
- <h2>AJAX Calls</h2>
- <div id="aget"></div>
- <script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
- <script>
- var count = 0;
- var MAX_CALLS = 100;
- var INTERVAL = 5000;
- function doGet() {
- count++;
- $.get('test.cfc', {
- method: 'test'
- }, function(data){
- $('#aget').append('<div>' + data + ' (GET)</div>');
- if (count < MAX_CALLS) setTimeout(doCalls,INTERVAL);
- });
- }
- function doPost() {
- count++;
- $.post('test.cfc', {
- method: 'test'
- }, function(data){
- $('#aget').append('<div>' + data + ' (POST)</div>');
- if (count < MAX_CALLS) setTimeout(doCalls,INTERVAL);
- });
- }
- function doCalls() {
- if (count%2) doGet();
- else doPost();
- }
- $(function(){
- doCalls();
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement