function getAvatar(authorEmail) {//获得头像代码封装函数
var nowtime = Math.round(new Date().getTime() / 1000);
$.get(apiurl, {
action : "get_avatar",
email : authorEmail,
t : nowtime
}, function(data) {
$('#get-avatar-img').fadeOut('slow', function() {
$('#get-avatar-img').html(data).fadeIn();
})
});
}
var avatarhtml = '<div id="get-avatar-img" style="display:none;">';
avatarhtml += '</div>';
$('#respond').append(avatarhtml);//添加头像HTML
if($('#email').val().length > 1)
getAvatar($('#email').val());//获得邮箱地址
$('#email').focusout(function() {//email输入框失去焦点绑定的动作
var authorEmail = $('#email').val();
var pattern = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
var flag = pattern.test(authorEmail);
if(flag) {
$('#get-avatar-img').html('载入头像中').fadeIn('fast');
getAvatar(authorEmail);
} else {
alert('请输入正确邮箱地址');
}
})
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : false ;
if($action){//留下以后添加功能的空间,你懂的。
switch ($action) {
case 'get_avatar':
$email = isset($_REQUEST['email']) ? $_REQUEST['email']: false ;
if($email){
echo get_avatar($email,60);
}
break;
default:
echo "请求内容不充分";
break;
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有