$('.ag_phone_cont[data-id=4664]').css("display","inline-block"); $('.ag_phone_cont[data-id=4664] em').html('+7 (812) 425-XX-XX'); $('.back_call[data-id=4664]').data("b_id",3257); if (typeof(gaUserId) == 'undefined') gaUserId = ''; $('.ag_phone_cont[data-id=4664] .ag_get_phone').bind('click',function(){ if ($('.ag_phone_cont[data-id=4664] .ag_get_phone').data('set')!=1) { $.ajax({ type: "POST", url: "https://agentguru.ru/api/v2/redirect", data: JSON.stringify({ resource: { s_id: '', id: 4664, source: 1, uid: gaUserId } }), success: function(phone) { if (phone=='') $('.ag_phone_cont[data-id=4664]').hide(); else { $('.ag_phone_cont[data-id=4664]').addClass('ag_phone_set'); //$('.ag_phone_r[data-id=4664]').html(phone); e = $('.ag_phone_r[data-id=4664]'); style = e.attr('style'); if (style==undefined) style=''; style=style+';text-decoration:none !important;color:'+e.css("color")+' !important;font-size:'+e.css("font-size")+' !important;font-weight:'+e.css("font-weight")+' !important;'; e.replaceWith(''+phone+''); } $('.ag_phone_cont[data-id=4664] .ag_get_phone').data('set',1); } }); } return false; });