通过使用Jquery插入javascript加载LinkedIn会员资料 [英] Load LinkedIn member profile by inserting javascript with Jquery
问题描述
我试图通过让用户输入他们的公开个人资料网址然后使用JQuery加载该个人资料来显示LinkedIn成员个人资料。当他们进入 www.linked.in/com/in/theirprofile
时,我称之为:
I am trying to display LinkedIn member profiles by having a user enter in their public profile URL then loading that profile using JQuery. When they enter in www.linked.in/com/in/theirprofile
, I am calling this:
$(document).ready( function(){
$("#linkedin_field").blur( function(){
$("#profile").html('<script type="IN/MemberProfile" data-id="' + $("#linkedin_field").val() + '" data-format="inline"><\/script>')
});
});
这会将javascript插入 #profile
div但它不显示成员的个人资料。如何在插入新的javascript时加载配置文件?
This does insert the javascript into the #profile
div but it doesn't display the member's profile. How can I get the profile to load when I insert the new javascript?
请注意,当我在开头包含有效的javascript时,此页面已成功加载配置文件用户个人资料。
Note that this page is successfully loading the profile when I include the javascript at the beginning with a valid user profile.
推荐答案
LinkedIn需要一行来解析呈现的javascript,所以必要的是:
It takes one line for LinkedIn to parse the rendered javascript, so all that's necessary is:
$(document).ready( function(){
$("#linkedin_field").blur( function(){
$("#profile").html('<script type="IN/MemberProfile" data-id="' + $("#linkedin_field").val() + '" data-format="inline"><\/script>')
});
IN.parse(document.getElementById("profile"))
});
这篇关于通过使用Jquery插入javascript加载LinkedIn会员资料的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!