I have tried different code and settings, but i still not working how it should be. I would like to add all the values from the array in to the makeSpaceInactive function of jQuery..
$(document).ready(function() {
var myArray = [ 'AB', 'AC']
function makeSpaceInactive(spaceKey) {
    jQuery.ajax({
        contentType: 'application/json',
        type: 'POST',
        url: '/rpc/json-rpc/confluenceservice-v2/setSpaceStatus',
        data: '["SPACEKEY", "ARCHIVED"]',
        success: function(response) {
          console.log(response);
        }, error: function(response) {
          console.log(response);
        }
    }); 
});
$.each(myArray, function (index, value) {
    makeSpaceInactive(value);
});
})
The values in the myArray should be looped in the makeSpaceInactive function with the data function where the SPACEKEY is. But i don't know how to replace the SPACEKEY data with the myArray values?
 
     
     
    