Last active
April 17, 2024 10:59
-
Star
(101)
You must be signed in to star a gist -
Fork
(33)
You must be signed in to fork a gist
Revisions
-
Jasdeep Khalsa revised this gist
Dec 21, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ // Long Polling (Recommened Technique - Creates An Open Connection To Server ∴ Fast) (function poll(){ $.ajax({ url: "server", success: function(data){ //Update your dashboard gauge -
Jasdeep Khalsa revised this gist
Dec 21, 2012 . No changes.There are no files selected for viewing
-
Jasdeep Khalsa revised this gist
Dec 21, 2012 . 3 changed files with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ // Long Polling (Recommened Technique - Creates A Open Connection To Server ∴ Fast) (function poll(){ $.ajax({ url: "server", success: function(data){ //Update your dashboard gauge This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ // The setTimeout Technique (Not Recommended - No Queues But New AJAX Request Each Time ∴ Slow) (function poll(){ setTimeout(function(){ $.ajax({ url: "server", success: function(data){ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ // The setInterval Technique (Not Recommended - Creates Queues of Requests ∴ Can Be Slow) setInterval(function(){ $.ajax({ url: "server", success: function(data){ //Update your dashboard gauge -
Jasdeep Khalsa created this gist
Dec 21, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ // Long Polling (function poll(){ $.ajax({ url: "server", success: function(data){ //Update your dashboard gauge salesGauge.setValue(data.value); }, dataType: "json", complete: poll, timeout: 30000 }); })(); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ // The setTimeout Technique (function poll(){ setTimeout(function(){ $.ajax({ url: "server", success: function(data){ //Update your dashboard gauge salesGauge.setValue(data.value); //Setup the next poll recursively poll(); }, dataType: "json"}); }, 30000); })(); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ // The setInterval Technique setInterval(function(){ $.ajax({ url: "server", success: function(data){ //Update your dashboard gauge salesGauge.setValue(data.value); }, dataType: "json"}); }, 30000);