#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Location
    uk
    Posts
    120
    Rep Power
    15

    What is wrong with this code?


    Someone in support hinted to me that this code is broken.

    Can anyone who knows JS tell me what is wrong and how to fix it?

    Here is the code...

    Code:
    <script type="text/javascript">
    function bemobCb(params) {
        var e1 = document.querySelectorAll('.cta-url-1');
        for (var i = 0; i < e1.length; i++) {
            e1[i].href = params.ctaUrl.replace('%%OFFER_NUMBER%%', '1');
        }
    }
    </script>
    <script type="text/javascript">!function(){var a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src="http://giftvoucher.pro/landing/96d16053-a16d-41a3-87fd-fe3e7d31cd27?callback=bemobCb&rule=1&path=1&landing=1&"+window.location.search.substring(1);var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}();</script><noscript><img src="http://giftvoucher.pro/landing/96d16053-a16d-41a3-87fd-fe3e7d31cd27?rule=1&path=1&landing=1" alt=""></noscript>
  2. #2
  3. Headless Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,966
    Rep Power
    9647
    Not sure why you're asking here instead of asking the person who did the hinting...
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Location
    uk
    Posts
    120
    Rep Power
    15
    Originally Posted by requinix
    Not sure why you're asking here instead of asking the person who did the hinting...
    Coz they are support of another platform and cant give advice on code
  6. #4
  7. Headless Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,966
    Rep Power
    9647
    Okay, well, I suppose I could guess at what they saw. It's hard to say something is wrong if it works. I assume it does, right? It does work? Because if it doesn't work and you're trying to fix it then that's really a better approach to take here than just a vague "someone said something is wrong".

    I mean, you have a function that isn't being called, but obviously something has to be calling it. It has a for loop that doesn't make sense. And some minimized code to inject an off-site script into the page.

    Nothing really stands out...
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Location
    uk
    Posts
    120
    Rep Power
    15
    I'll have to abandon using this code for now then,

    Thanks though

IMN logo majestic logo threadwatch logo seochat tools logo