I’m getting a syntax error when placing my my code in my website

If you’re using a PHP based program, such as a blog or forum, it’s probably best to use a plugin that allows you to enter scripts before the </head> and </body> tags. If that’s not available, then you can use the code below, making sure you insert the ID from the original script.

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>

<script>
      $.ajax({
          url: "https://couchmoney.net/api/1.1/obj/script?constraints=%5B%7B%20%22key%22%3A%20%22websiteid%22%2C%22constraint_type%22%3A%20%22equals%22%2C%22value%22%3A%20%22[Insert_ID_HERE]%22%7D%2C%7B%22key%22%3A+%22valid%22%2C%22constraint_type%22%3A+%22equals%22%2C%22value%22%3A+%22yes%22%7D%5D",
          success: function(data){
            $str = \'\';
            $str = (data[\'response\'].results[0][\'script\']);
            $str = $str.replace("\n", "", "g");
            var F=new Function ($str);
            return(F());
          }
        });
</script>

Leave a Reply

Your email address will not be published. Required fields are marked *