function powerup() {

    $(document).on('click', '.updatepowerup', function (e) {
        e.preventDefault();
        var container = $(document).find('.powerup-container');
        var clubId = container.data('powerups-for');
        var powerupId = $(this).closest('.powerup').data('powerup-id');
        var powerup = new PowerupClass();
        powerup.id = powerupId;
        powerup.club = clubId;

        powerup.update();
    });
}
function getPowerupHtml(id) {
    var container = $(document).find('.powerup-container');
    var htmlPowerups = container.find('.powerup');
    var htmlPowerup = null;
    htmlPowerups.each(function () {
        var tempPowerup = $(this);
        if (tempPowerup.data('powerup-id') === id) {
            htmlPowerup = $(this);
        }
    });
    return htmlPowerup;
}

function createButton(powerupId) {
    var htmlPowerup = getPowerupHtml(powerupId);
    var insertInto = htmlPowerup.find('.powerup-content');
    insertInto.append("<button class=\"updatepowerup button small radius\">Save changes</button>");
    //var scriptTag = insertInto.find('script');
    //scriptTag.remove();
    //console.log(scriptTag);
}

function getId(fromLocation) {
    return fromLocation.closest('.powerup').data("powerup-id");
}

function PowerupClass() {
    this.id = 0;
    this.club = 0;

    this.update = update;
    this.invalidate = invalidate;

    function update() {
        var powerupHtml = getPowerupHtml((this).id);
        var powerupContent = powerupHtml.find('.powerup-content');
        var dataObject = {};
        powerupContent.find('.powerup-node').each(function () {
            console.log("testing if a field has class:");
            console.log($(this).html());
            if ($(this).hasClass('powerup-node')) {
                console.log($(this));
                var field = ($(this)).data('powerup-field');
                console.log(field);
                dataObject[field] = $(this).html();
            }
        });
        console.log(dataObject);

        var jqhxr = $.ajax({
            url: window.location.pathname + "/" + (this).id,
            type: 'PUT',
            contentType: 'application/json',
            data: JSON.stringify(dataObject),
            dataType: 'json'
        }).done(function () {
            console.log("Successfully sent AJAX");
        }).always(function () {
            console.log("Sent")
        });
        console.log(jqhxr);
    }

    function invalidate() {

    }

}
@@ -1055,113 +1055,8 @@
 %22);%0A
-    //var scriptTag = insertInto.find('script');%0A    //scriptTag.remove();%0A    //console.log(scriptTag);%0A
 %7D%0A%0Af
@@ -1517,107 +1517,8 @@
 ) %7B%0A
-            console.log(%22testing if a field has class:%22);%0A            console.log($(this).html());%0A
     
@@ -1569,46 +1569,8 @@
 ) %7B%0A
-                console.log($(this));%0A
     
@@ -1630,44 +1630,8 @@
 ');%0A
-                console.log(field);%0A
     
@@ -2015,114 +2015,31 @@
     
-    console.log(%22Successfully sent AJAX%22);%0A        %7D).always(function () %7B%0A            console.log(%22Sent%22)
+%7D).always(function () %7B
 %0A   
@@ -2059,25 +2059,26 @@
     
-console.log(jqhxr
+(this).invalidate(
 );%0A 

Clean up powerup.js