jQuery Simple Example

HTML

<script src="//www.addressfinder.co.nz/assets/v2/widget.js"></script>
<body>

</body>

CSS

body {
    padding: 5px;
}

label {
    font-weight: bold;
}

input[type=text] {
    width: 20em
}

p {
    margin: 1em 0 0;
}

JavaScript

$(document).ready(function() {
  var myArray = [ 'AB', 'AC']
	$("body").append('<br>');
  function makeSpaceInactive(spaceKey) {
      $("body").append(spaceKey+'<br>');
      /*jQuery.ajax({
          contentType: 'application/json',
          type: 'POST',
          url: '/rpc/json-rpc/confluenceservice-v2/setSpaceStatus',
          data: {arrayelement:spaceKey},
          success: function(response) {
            console.log(response);
          }, error: function(response) {
            console.log(response);
          }
      }); */
  }

  $.each(myArray, function (index, value) {
      makeSpaceInactive(value);
  });
});