diff options
author | Vinicius Coque <vcoque@gmail.com> | 2011-10-22 20:13:06 -0200 |
---|---|---|
committer | Vinicius Coque <vcoque@gmail.com> | 2011-10-22 20:13:06 -0200 |
commit | e03ef9a02cb3b3e328be1eab5230114483082853 (patch) | |
tree | e5c7dc1f4011fc6e6bbc9ceb8f79b64f319d7a04 /usr/local/www/status_graph.php | |
parent | 78d84a88e0f87ad2b44aa8f3c6b5d37fee2135e7 (diff) | |
download | pfsense-e03ef9a02cb3b3e328be1eab5230114483082853.zip pfsense-e03ef9a02cb3b3e328be1eab5230114483082853.tar.gz |
Converting ajax code from prototype to jQuery
Diffstat (limited to 'usr/local/www/status_graph.php')
-rwxr-xr-x | usr/local/www/status_graph.php | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/usr/local/www/status_graph.php b/usr/local/www/status_graph.php index bc689ab..628c9bc 100755 --- a/usr/local/www/status_graph.php +++ b/usr/local/www/status_graph.php @@ -103,21 +103,20 @@ function bandwidthAjax(hostinterface) { uri = "bandwidth_by_ip.php?if=" + hostinterface; var opt = { // Use GET - method: 'get', - asynchronous: true, - // Handle 404 - on404: function(t) { - alert('Error 404: location "' + t.statusText + '" was not found.'); + type: 'get', + error: function(req) { + // Handle 404 + if(req.status == 404) + alert('Error 404: location "' + uri + '" was not found.'); + // Handle other errors + else + alert('Error ' + req.status + ' -- ' + req.statusText); }, - // Handle other errors - onFailure: function(t) { - alert('Error ' + t.status + ' -- ' + t.statusText); - }, - onSuccess: function(t) { - updateBandwidthHosts(t.responseText); + success: function(data) { + updateBandwidthHosts(data); } } - new Ajax.Request(uri, opt); + jQuery.ajax(uri, opt); } function updateBandwidthHosts(data){ @@ -145,21 +144,19 @@ function updateBandwidthHosts(data){ hostbandwidthOut.innerHTML = hostinfo[2] + " Bits/sec"; //make the row appear if hidden - var rowid = "host" + y; - textlink = d.getElementById(rowid); - if (textlink.style.display == "none"){ + var rowid = "#host" + y; + if (jQuery(rowid).css('dislay') == "none"){ //hide rows that contain no data - Effect.Appear(rowid, {duration:1}); + jQuery(rowid).show(1000); } } } else { - var rowid = "host" + y; - textlink = d.getElementById(rowid); - if (textlink.style.display != "none"){ + var rowid = "#host" + y; + if (jQuery(rowid).css('dislay') != "none"){ //hide rows that contain no data - Effect.Fade(rowid, {duration:2}); + jQuery(rowid).fadeOut(2000); } } } |