Subversion Repositories HomeAutomation

Rev

Rev 2104 | Rev 2111 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 2104 Rev 2105
Line 75... Line 75...
75
        {
75
        {
76
          commandActive = true;
76
          commandActive = true;
77
 
77
 
78
          jQuery.getJSON("backend.php?ajax", { command: command }, function(jsonData)
78
          jQuery.getJSON("backend.php?ajax", { command: command }, function(jsonData)
79
          {
79
          {
-
 
80
            handleCommandResponse(true, jsonData, callback);
-
 
81
          }).error(function()
-
 
82
          {
-
 
83
            handleCommandResponse(false, {}, callback);
-
 
84
          });
-
 
85
        }
-
 
86
      }
-
 
87
 
-
 
88
      function handleCommandResponse(success, jsonData, callback)
-
 
89
      {
80
            commandActive = false;
90
        commandActive = false;
81
 
91
 
82
            if (commandQueue.length > 0)
92
        if (commandQueue.length > 0)
83
            {
93
        {
84
              var commandItem = commandQueue.shift();
94
          var commandItem = commandQueue.shift();
85
 
95
 
86
              sendCommand(commandItem.command, commandItem.callback);
96
          sendCommand(commandItem.command, commandItem.callback);
87
            }
97
        }
88
 
98
 
-
 
99
        if (success)
-
 
100
        {
-
 
101
          if (callback)
-
 
102
          {
89
            callback(jsonData);
103
            callback(jsonData);
90
          });
104
          }
-
 
105
        }
-
 
106
        else
-
 
107
        {
-
 
108
          console.log("command failed!");
91
        }
109
        }
92
      }
110
      }
93
    </script>
111
    </script>
94
 
112
 
95
    <script>
113
    <script>