# Checken ob JS plugin ausgeführt ist

**URL:** <https://forum.shopware.com/t/checken-ob-js-plugin-ausgefuehrt-ist/92369>\
**Category:** Programmierung\
**Tags:** general, programming\
**Created:** [14. Januar 2022 um 11:56 UTC](https://forum.shopware.com/t/checken-ob-js-plugin-ausgefuehrt-ist/92369 "2022-01-14T11:56:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZOth](https://avatars.discourse-cdn.com/v4/letter/z/a9a28c/32.png) [@ZOth](https://forum.shopware.com/u/ZOth)\
**Post date:** [14. Januar 2022 um 11:56 UTC](https://forum.shopware.com/t/checken-ob-js-plugin-ausgefuehrt-ist/92369/1 "2022-01-14T11:56:06Z")

</div>

Hallo !,

Ich will nach dem die Artikel Variante geändert wird einfach meine neu erstellte Tab neu laden.  
in meinem fall so

```auto
;(function ($, window) {

    $.subscribe('plugin/swAjaxVariant/onChange', function(event, plugin){
    console.info("changed")

    $(".content--youtube").load(location.href + " #youtubelink");

});

})(jQuery, window);

```

Das problem ist, ich brauche die Seite neu laden nach dem eigentlich das onChange ausgeführt wurde weil dann schon habe ich requestData();

dann erhält mein Tab .content-youtube die Neue Link für Variant.

Wie kann ich so machen dass ich sag Wenn `plugin/swAjaxVariant/onChange` ausgeführt und fertig ist, dann  
`$(".content--youtube").load(location.href + " #youtubelink");` ausführen.

ich arbeite nicht sehr viel mit js deswegen bin ich sehr schwach, habe sogar diesen code geschrieben, aber das ‚change‘ wird nur einmal ausgeführt.

```auto
;(function ($, window) {
    $.plugin('twpYoutube', {

        defaults: {

            'selectorClass': '.selector-classforvariants',

        },

        init: function () {
            var me = this;

            me.applyDataAttributes();

            me.selectorClass = me.opts.selectorClass;

            me.registerEvents();

            me.onInputChange();

        },

        registerEvents: function() {
            var me = this;
            me._on(me.selectorClass, 'change', $.proxy(me.onChange, me));
        },

        onInputChange: function(e){
            var me = this;

            var selector = $(me.selectorClass);

            $(selector).on('change',function(e) {
                console.info(this[this.selectedIndex].text);
            });

        },

        onChange: function(){
            var me = this;
            alert('select changed!');
        },

    });
    $('.selector-classforvariants').twpYoutube();
})(jQuery, window);

```

Danke
