Browse Source

Fixes #859: Fix Javascript for connection status toggle button

Jeremy Stretch 8 years ago
parent
commit
f4f41a5985
1 changed files with 3 additions and 2 deletions
  1. 3 2
      netbox/templates/dcim/device.html

+ 3 - 2
netbox/templates/dcim/device.html

@@ -548,9 +548,10 @@
 {% block javascript %}
 <script type="text/javascript">
 function toggleConnection(elem, api_url) {
+    var url = netbox_api_path + api_url + elem.attr('data') + "/";
     if (elem.hasClass('connected')) {
         $.ajax({
-            url: netbox_api_path + api_url + elem.attr('data') + "/",
+            url: url,
             method: 'PATCH',
             dataType: 'json',
             beforeSend: function(xhr, settings) {
@@ -569,7 +570,7 @@ function toggleConnection(elem, api_url) {
         });
     } else {
         $.ajax({
-            url: api_url + elem.attr('data') + "/",
+            url: url,
             method: 'PATCH',
             dataType: 'json',
             beforeSend: function(xhr, settings) {