Short URL generator not working in tinycc_client

162 Views Asked by At

Tinycc_client is not working. I am trying to generate short URL on the basis of given refer code. It keeps saying me not defined just like the screenshot. There is no error on console.

The output return [object Object]

script.js

    arrjson = {
            "4397242":"3627884"
        }

    var longLink = "";
    var customParam = "";
    function getCustomShortLink() {
        var client = new tinycc_client({
            api_root_url: "https://tinycc.com/tiny/api/3/",
            username: 'mihir',
            api_key: '*******-****-****-****-*******'
        });

        client.set_working_domain("lpts.2.vu");

            for (x in arrjson) {
                longLink += "http://app.nextbee.com/api/refer/"+arrjson[x];
                customParam = x;
                client.shorten(longLink, {"custom_hash": customParam}).then(function (result) {
                     document.getElementById("demo").innerHTML += result +"<br>";
                });
            }

        }



    getCustomShortLink()

html:

<div id="demo">

</div>  
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="js/tinycc_client.js"></script>
<script src="js/script.js"></script>

It keeps saying that a variable is not defined.

error

0

There are 0 best solutions below