$('.ag_phone_cont[data-id=4549]').css("display","inline-block"); $('.ag_phone_cont[data-id=4549] em').html('+7 (812) 425-XX-XX'); $('.back_call[data-id=4549]').data("b_id",3136); if (typeof(gaUserId) == 'undefined') gaUserId = ''; $('.ag_phone_cont[data-id=4549] .ag_get_phone').bind('click',function(){ if ($('.ag_phone_cont[data-id=4549] .ag_get_phone').data('set')!=1) { $.ajax({ type: "POST", url: "https://agentguru.ru/api/v2/redirect", data: JSON.stringify({ resource: { s_id: '', id: 4549, source: 1, uid: gaUserId } }), success: function(phone) { if (phone=='') $('.ag_phone_cont[data-id=4549]').hide(); else { $('.ag_phone_cont[data-id=4549]').addClass('ag_phone_set'); //$('.ag_phone_r[data-id=4549]').html(phone); e = $('.ag_phone_r[data-id=4549]'); 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=4549] .ag_get_phone').data('set',1); } }); } return false; });