You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.1 KiB
JavaScript

protocol = window.location.protocol;
function get_cdk(game_id,cid,name,title)
{
if (!game_id || !cid){
alert('参数错误');
}else{
$.ajax({
url:protocol+"//www.6kw.com/api/get_cdk.php",
data:{"game_id":game_id,"cid":cid},
type:"POST",
dataType:"json",
success:function(data){
if (data['errno']=='ok'){
$('#gift_box').show();
$('.popup_bg').show();
$("#gift_name").html(name);
$("#giftDetail").html(title);
$("#cdk").html(data['msg']);
$("#cdk").val(data['msg']);
}else if(data['errno']=='no'){
alert(data['msg']);
}else if(data['errno']=='no_login'){
alert('请先登录');
location.href=protocol+"//www.6kw.com/turn.php?act=reg";
}
}
});
}
}
$("#copy").click(function(){
if($("#cdk").html() == ''){
var cdk=$("#cdk").val();
}else{
var cdk=$("#cdk").html();
}
$('#copy').zclip({
path: protocol+"//image.6kw.com/public/swf/ZeroClipboard.swf",
copy: function(){
return cdk;
},
afterCopy:function(){/* 复制成功后的操作 */
alert('复制成功!');
$('.popup_bg').hide();
$('#gift_box').hide();
}
});
});