对于使用TOP JS-SDK的用户:
1.TAE中JS-SDK的引用,请添加:<script src="http://l.tbcdn.cn/apps/top/x/sdk.js?appkey=$appKey" ></script>
2.如果需要生成TOP JS SDK的Cookie信息,请添加一下代码:$jssdkService->init($appKey,$secret);
TOP JS-SDK文档:请点击这里
demo下载:点击下载
前端页面代码:
<?php
$jssdkService->init('yourAppkey','appsecret');
?>
<script src="http://l.tbcdn.cn/apps/top/x/sdk.js?appkey=yourAppkey" ></script>
<script src="/assets/javascripts/jssdktest.js"></script>
<div class="top-authbtn-container"></div>
JS文件代码:
TOP.api('rest', 'get',{
method:'taobao.taobaoke.widget.items.convert',
track_iids:'19237740785_track_11116',
fields:'num_iid,click_url,commission_rate'
//method:'taobao.favorite.add',
//item_numid:id,
//collect_type:'ITEM',
//session:session,
//shared:'true'
},
function(resp){
if(resp){
KISSY.alert(KISSY.JSON.stringify(resp));
}else{
KISSY.alert(KISSY.JSON.stringify(resp.error_response.msg));
}
if(!resp){
KISSY.alert("resp为空");
}
}
)
TOP.ui("authbtn", {
container: '.top-authbtn-container',
name:'立即使用',
type:'mini',
callback: function(data){
KISSY.alert(KISSY.JSON.stringify(data));
}
});