简体   繁体   English

JavaScript 事件监听器

[英]JavaScript eventlistener

unfortunately I am stuck on a problem.不幸的是我遇到了一个问题。

We have included this code via iFrame in our website https://kitarino.net/platz-anfrage我们已通过 iFrame 将此代码包含在我们的网站https://kitarino.net/platz-anfrage

This is the code:这是代码:

<div id="nemplads" data-lang="browser"></div>
        <script type="text/javascript">
              (function() {
                var d = document,
                s = d.createElement('script');
                s.src = 'https://kitarinocockpit.nemborn.com/Script/NemPlads/preregister-v1.0.0.1.js';
                s.id = 'nemplads-script';
                s.setAttribute('data-timestamp', +new Date());
                // window.addEventListener('success', (e) => {
                //   console.log(e.detail); // Original request arguments
                // });
                (d.head || d.body).appendChild(s);
              })();
            </script>

When someone has registered via the form, I would like to call the website https://kitarino.net/bestaetigung-bewerbung - so that the users gets a confirmation.当有人通过表格注册时,我想致电网站https://kitarino.net/bestaetigung-bewerbung - 以便用户得到确认。

Can you help me with this?你能帮我吗? Unfortunately my attempts always fail.不幸的是,我的尝试总是失败。 I don't know JavaScript well either and my colleague couldn't help me.我也不太了解 JavaScript,我的同事帮不了我。

I had tried it with this:我试过这个:

// window.addEventListener('success', (e) => {
// console.log(e.detail); // Original request arguments
// loadedwindow(e) {window.open("https://www.google.com","_self")}
// });

I am grateful for any hint;)我很感激任何提示;)

best, Alex最好的,亚历克斯

We found a solution:我们找到了解决方案:

const items = document.location.search.substr(1).split("&");
            for (let index = 0; index < items.length; index++) {
                const getParam = items[index].split("=");
                if (getParam[0] === 'id') {
                    document.location.href = 'https://www.kitarino.net/bestatigung-platzanfrage?id=' + decodeURIComponent(getParam[1]);
                    break;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM