Commits

Shrikant Sharat Kandula  committed 3d48c01

Fix a critical issue with app breakdown when manually loading jQuery

  • Participants
  • Parent commits 76024e5

Comments (0)

Files changed (1)

File pollfresh.php

 
     var self = PollFresh.state = PollFresh.state || {};
 
+    var $;
+
     function collectFiles() {
 
         var i = 0, res = self.resources = {};
         self.loaded = true;
         self.isRequesting = true;
         $.ajax({
-            url: loc + (start ? 'start' : 'comet-poll'),
+            url: loc + (start ? 'start' : 'poll'),
             data: data,
             success: function (response) {
                 if(start) {
         });
     }
 
-    function run() {
+    function run(jQuery) {
+        $ = jQuery;
         $( function () {
             poll(true);
             setInterval( function () { poll() }, 1000);
 
     if(self.loaded) {
         alert('PollFresh already loaded.');
-        // poll();
         return;
     }
 
-    var $;
-
     if(typeof jQuery == 'undefined') {
         var d = document, s = d.createElement('script');
         s.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';
         s.type = 'text/javascript';
         s.onload = function () {
-            $ = jQuery.noConflict();
+            run(jQuery.noConflict());
         };
         d.body.appendChild(s);
     } else {
-        $ = window.jQuery;
-        run();
+        run(window.jQuery);
     }
 
 }