diff --git a/modules/consentAdmin/templates/consentadmin.php b/modules/consentAdmin/templates/consentadmin.php
index 59a9e8647636daebc412b896a619bcb1b2af75a1..3895ef9f70e7274d627cdb2302a17bb5412ca53a 100644
--- a/modules/consentAdmin/templates/consentadmin.php
+++ b/modules/consentAdmin/templates/consentadmin.php
@@ -1,7 +1,6 @@
 <?php 
     $this->data['head'] = '<link rel="stylesheet" type="text/css" href="'.SimpleSAML\Module::getModuleURL("consentAdmin/assets/css/consentAdmin.css").'" />'."\n";
     $this->data['head'] .= '<script type="text/javascript" src="'.SimpleSAML\Module::getModuleURL("consentAdmin/assets/js/consentAdmin.js").'"></script>';
-    $this->data['head'] .= '<script type="text/javascript" src="'.SimpleSAML\Module::getModuleURL("consentAdmin/assets/js/consentSimpleAjax.js").'"></script>';
     // default theme
     $this->includeAtTemplateBase('includes/header.php');
 ?>
@@ -13,7 +12,7 @@
             <table>
             <tr>
                 <th width="80%"><?php echo $this->t('{consentAdmin:consentadmin:service_provider_header}') ?></th>
-                <th width="140"><?php echo $this->t('{consentAdmin:consentadmin:status_header}') ?></th>
+                <th><?php echo $this->t('{consentAdmin:consentadmin:status_header}') ?></th>
             </tr>
             <?php
             $spList = $this->data['spList'];
@@ -23,7 +22,7 @@
             $attributes_text = $this->t('{consentAdmin:consentadmin:attributes_text}');
             foreach ($spList as $spName => $spValues) {
                 if (!is_null($spValues['serviceurl'])) {
-                    $htmlSpName = '<a href="'.$spValues['serviceurl'].'" style="color: black; font-weight: bold;">'.htmlspecialchars($spValues['name']).'</a>';
+                    $htmlSpName = '<a class="serviceUrl" href="'.$spValues['serviceurl'].'">'.htmlspecialchars($spValues['name']).'</a>';
                 } else {
                     $htmlSpName = htmlspecialchars($spValues['name']);
                 }
@@ -36,8 +35,8 @@
 <tr class="$row_class">
 <td>
     <table>
-      <tr class="$row_class"><td><span class='caSPName'><span title='$spDescription'>$htmlSpName</span>&emsp;<span style="font-size: 80%;"onclick="javascript:toggleShowAttributes('$show_spid');"><span id='showing_$show_spid'>$show_text</span><span id='hiding_$show_spid' style='display:none;'>$hide_text</span>$attributes_text</span></span></td></tr>
-      <tr><td colspan="2" class="caAttributes"><div id="attributes_$show_spid" style="display: none;">
+      <tr class="$row_class"><td><span class='caSPName'><span title='$spDescription'>$htmlSpName</span>&emsp;<span class="show_hide" id="show_hide_$show_spid"><span id='showing_$show_spid'>$show_text</span><span id='hiding_$show_spid'>$hide_text</span> $attributes_text</span></span></td></tr>
+      <tr><td colspan="2" class="caAttributes"><div id="attributes_$show_spid">
 TRSTART;
                 $attributes = $spValues['attributes_by_sp'];
                 if ($this->data['showDescription']) {
@@ -62,7 +61,7 @@ TRSTART;
   </table>
 </td>
 
-<td class='caAllowed'><input onclick="javascript:checkConsent(this.value, $show_spid, this.checked)" value='$consentValue' type='checkbox' $checkedAttr /><span id="consentText$show_spid">$consentText</span></td>
+<td class='caAllowed'><input id="checkbox_$show_spid" class="checkbox" value='$consentValue' type='checkbox' $checkedAttr /><span id="consentText_$show_spid">$consentText</span></td>
 TRSTART;
                 echo "</tr>\n";
                 $show_spid++;
diff --git a/modules/consentAdmin/templates/consentadmin.twig b/modules/consentAdmin/templates/consentadmin.twig
index e0eaf6d58dbc5d5b3b014b4bdabab17a83ccbe6d..d27b8a63d399432c22585deb97e35d6aa7f54156 100644
--- a/modules/consentAdmin/templates/consentadmin.twig
+++ b/modules/consentAdmin/templates/consentadmin.twig
@@ -7,7 +7,6 @@
 
 {% block postload %}
 <script src="{{ baseurlpath }}assets/js/consentAdmin.js"></script>
-<script src="{{ baseurlpath }}assets/js/consentSimpleAjax.js"></script>
 {% endblock %}
 
 {% block content %}
@@ -36,18 +35,18 @@
                 {% if spValues.serviceurl is defined %}
                     {{ spValues.name|escape('html') }}
                 {% else %}
-                    <a href="{{ spValues.serviceurl }}" style="color: black; font-weight: bold">{{ spValues.name|escape('html') }}</a>
+                    <a class="serviceUrl" href="{{ spValues.serviceurl }}">{{ spValues.name|escape('html') }}</a>
                 {% endif %}
                 </span>
-                <span style="font-size: 80%" onclick="javascript:toggleShowAttributes({{ loop.index0 }});">
+                <span class="show_hide" id="show_hide_{{ loop.index0 }}">
                     <span id="showing_{{ loop.index0 }}">{{ '{consentAdmin:consentadmin:show}'|trans }}</span>
-                    <span id="hiding_{{ loop.index0 }}" style="display: none">{{ '{consentAdmin:consentadmin:hide}'|trans }}</span>
+                    <span id="hiding_{{ loop.index0 }}">{{ '{consentAdmin:consentadmin:hide}'|trans }}</span>
                     {{ '{consentAdmin:consentadmin:attributes_text}'|trans }}
                 </span>
             </span>
         </td>
         <td class="caAttributes">
-            <div id="attributes_{{ loop.index0 }}" style="display: none">
+            <div id="attributes_{{ loop.index0 }}">
             {% if showDescription %}
                 <p>{{ '{consentAdmin:consentadmin:consentadmin_purpose}'|trans }}{{ spValues.description|escape('html') }}</p>
             {% endif %}
@@ -69,7 +68,7 @@
             </div>
         </td>
         <td class="caAllowed">
-            <input onclick="javascript:checkConsent(this.value, {{ loop.index0 }}, this.checked)" value='{{ spValues.consentValue }}' type='checkbox'{% if spValues.consentStatus == 'ok'%} checked="checked"{% endif %} /><span id="consentText{{ loop.index0 }}">{% if spValues.consentStatus == 'changed' %}attributes has changed{% endif %}</span>
+            <input class="checkbox" id="checkbox_{{ loop.index0 }}" value='{{ spValues.consentValue }}' type='checkbox'{% if spValues.consentStatus == 'ok'%} checked="checked"{% endif %} /><span id="consentText_{{ loop.index0 }}">{% if spValues.consentStatus == 'changed' %}attributes has changed{% endif %}</span>
         </td>
     </tr>
 {% endfor %}
diff --git a/modules/consentAdmin/www/assets/css/consentAdmin.css b/modules/consentAdmin/www/assets/css/consentAdmin.css
index 86735025420d0b54880d7d0971d430b12c6200a9..94c4a190c4c796224a8ad9a7c9ed4b6449552a9f 100644
--- a/modules/consentAdmin/www/assets/css/consentAdmin.css
+++ b/modules/consentAdmin/www/assets/css/consentAdmin.css
@@ -20,3 +20,20 @@ tr.row1 td {
 a.orange {
     color: #ffd633;
 }
+
+span.show_hide {
+    font-size: 80%;
+}
+
+a.serviceUrl {
+    color: black;
+    font-weight: bold;
+}
+
+span[id^='hiding_'], span[id*='hiding_'] {
+    display: none;
+}
+
+div[id^='attributes_'], div[id*='attributes_'] {
+    display: none;
+}
diff --git a/modules/consentAdmin/www/assets/js/consentAdmin.js b/modules/consentAdmin/www/assets/js/consentAdmin.js
index cfe0fb71ae4148f0e12cef49453901896b67d971..7c0359cd4bf099f027b2a845ffc836921bb36010 100644
--- a/modules/consentAdmin/www/assets/js/consentAdmin.js
+++ b/modules/consentAdmin/www/assets/js/consentAdmin.js
@@ -1,3 +1,79 @@
-function setConsentText(consentStatus, show_spid) {
-    document.getElementById("consentText" + show_spid).innerHTML = consentStatus;
+var xmlHttp;
+
+function checkConsent()
+{
+    var show_spid = this.id.charAt(this.id.length-1);
+    var checkbox = document.getElementById("checkbox_"+show_spid);
+
+    xmlHttp = GetXmlHttpObject()
+    if (xmlHttp == null) {
+        alert("Browser does not support HTTP Request")
+        return
+    }
+
+    var url = "consentAdmin.php"
+    url = url+"?cv="+checkbox.value
+    url = url+"&action="+checkbox.checked
+    url = url+"&sid="+Math.random()
+
+    xmlHttp.onreadystatechange=function() {
+        if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
+            document.getElementById("consentText_" + show_spid).innerHTML = xmlHttp.responseText;
+        }
+    }
+
+    xmlHttp.open("GET", url, true)
+    xmlHttp.send(null)
 }
+
+// This function creates an XMLHttpRequest
+function GetXmlHttpObject()
+{
+    var xmlHttp = null;
+    try {
+        // Firefox, Opera 8.0+, Safari
+        xmlHttp = new XMLHttpRequest();
+    } catch (e) {
+        //Internet Explorer
+        try {
+            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
+        } catch (e) {
+            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
+        }
+    }
+    return xmlHttp;
+}
+
+function toggleShowAttributes()
+{
+    var show_spid = this.id.charAt(this.id.length-1);
+
+    var disp = document.getElementById('attributes_' + show_spid);
+    var showing = document.getElementById('showing_' + show_spid);
+    var hiding = document.getElementById('hiding_' + show_spid);
+
+    disp.style.display = (disp.style.display == 'none' ? 'block' : 'none');
+    showing.style.display = (disp.style.display == 'none' ? 'inline' : 'none');
+    hiding.style.display = (disp.style.display == 'none' ? 'none' : 'inline');
+}
+
+document.addEventListener(
+    'DOMContentLoaded',
+    function () {
+        var show_hide = document.getElementsByClassName("show_hide");
+        for (var i = 0; i < show_hide.length; i++) {
+            show_hide[i].addEventListener(
+                'click',
+                toggleShowAttributes
+            );
+        }
+
+        var checkbox = document.getElementsByClassName("checkbox");
+        for (var i = 0; i < checkbox.length; i++) {
+            checkbox[i].addEventListener(
+                'click',
+                checkConsent
+            );
+        }
+    }
+);
diff --git a/modules/consentAdmin/www/assets/js/consentSimpleAjax.js b/modules/consentAdmin/www/assets/js/consentSimpleAjax.js
deleted file mode 100644
index 7ea896c630fa05a2f269330d63f7d70a4837232f..0000000000000000000000000000000000000000
--- a/modules/consentAdmin/www/assets/js/consentSimpleAjax.js
+++ /dev/null
@@ -1,70 +0,0 @@
-var xmlHttp;
-
-function checkConsent(consentValue, show_spid, checkAction)
-{ 
-	xmlHttp=GetXmlHttpObject()
-	if (xmlHttp==null) {
- 		alert ("Browser does not support HTTP Request")
- 		
- 		return
-	}
-	
-	var url="consentAdmin.php"
-	url=url+"?cv="+consentValue
-	url=url+"&action="+checkAction
-	url=url+"&sid="+Math.random()
-	xmlHttp.onreadystatechange=function() { 
-	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
-	{ 
-		setConsentText(xmlHttp.responseText, show_spid);
-	} 
-}
-
-	xmlHttp.open("GET",url,true)
-	xmlHttp.send(null)
-}
-
-// This function will be automaticly called when the Ajax call is done returning data
-function stateChanged() { 
-	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
-	{ 
-		//Alert("Status of consent:"  + xmlHttp.responseText );
-	} 
-}
-
-// This function creates an XMLHttpRequest
-function GetXmlHttpObject() {
-	var xmlHttp=null;
-	try
- 	{
-		// Firefox, Opera 8.0+, Safari
-		xmlHttp=new XMLHttpRequest();
-	}
-	catch (e)
-	{
-		//Internet Explorer
-		try
-		{
-			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
-		}
-		catch (e)
-		{
-			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
-		}
-	}
-	
-	return xmlHttp;
-}
-
-function toggleShowAttributes(show_spid) {
-	var disp = document.getElementById('attributes_' + show_spid);
-	//var showhide = document.getElementById('showhide_' + show_spid);
-	var showing = document.getElementById('showing_' + show_spid);
-	var hiding = document.getElementById('hiding_' + show_spid);
-	
-	disp.style.display = (disp.style.display == 'none' ? 'block' : 'none');
-	//showhide.innerHTML = (disp.style.display == 'none' ? 'Show' : 'Hide')
-	showing.style.display = (disp.style.display == 'none' ? 'inline' : 'none');
-	hiding.style.display = (disp.style.display == 'none' ? 'none' : 'inline');
-	//alert('hiding display'+hiding.display);
-}
diff --git a/modules/consentAdmin/www/consentAdmin.php b/modules/consentAdmin/www/consentAdmin.php
index 628d1c4e0a51f4e9db73f8e7097bb1a15b5c454b..c1a2a0277d1f7f7c33eafaadc4ce81c8f0d62353 100644
--- a/modules/consentAdmin/www/consentAdmin.php
+++ b/modules/consentAdmin/www/consentAdmin.php
@@ -150,7 +150,7 @@ if (!empty($_GET['action'])) {
 
 // Remove services, whitch have consent disabled
 if (isset($idp_metadata['consent.disable'])) {
-    foreach ($idp_metadata['consent.disable'] AS $disable) {
+    foreach ($idp_metadata['consent.disable'] as $disable) {
         if (array_key_exists($disable, $all_sp_metadata)) {
             unset($all_sp_metadata[$disable]);
         }