Tinycc_client无效。我试图在给定的引用代码的基础上生成短URL。它一直说我没有像屏幕截图那样定义。控制台上没有错误。
输出返回[object Object]
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()
<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>
一直说没有定义变量。