Fixes #859: Fix Javascript for connection status toggle button

This commit is contained in:
Jeremy Stretch 2017-01-31 09:41:25 -05:00
parent af3c9eaec1
commit f4f41a5985

View File

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