2012-08-22 69 views
0

我正在嘗試將LinkedIn登錄功能集成到我的網站上,但按鈕不顯示。代碼是:LinkedIn Api登錄按鈕不顯示

<head><script type="text/javascript" src="http://platform.linkedin.com/in.js"> 
    <body> 

<script type="IN/Login" data-onAuth="onLinkedInAuth"></script> 
</script> 
    </body> 
</head> 

我已經制作了這個jsfiddle它也有幫助。

我在編程的耳朵後面相當溼,所以我確信它的一些簡單的東西,當我們想要理解整個api時,我很想念它。一點幫助就足夠了。

回答

2

你提供的html都搞砸了 - 身體不應該高於頭部!查看thisthis瞭解基礎知識。

enter image description here

要獲得登錄頁面如下說明linkedin developer page

首先,您需要get an API key

比,建立HTML是這樣的:

<html> 
<head> 
<script type="text/javascript" src="http://platform.linkedin.com/in.js"> 
    api_key: YOUR_API_KEY_GOES_HERE 
    authorize: true 
</script> 

<script type="text/javascript"> 
function onLinkedInAuth() { 
    IN.API.Profile("me") 
    .result(function(me) { 
     var id = me.values[0].id; 
     // AJAX call to pass back id to your server 
    }); 
} 
</script> 
</head> 

<body> 
<script type="IN/Login" data-onAuth="onLinkedInAuth"></script> 


</body> 
</html> 
0

好你的訂單出現問題與您的標籤。你不能把身體標籤放在頭上。嘗試也許這:

<head> 
    <script type="text/javascript" src="http://platform.linkedin.com/in.js"></script> 
</head> 
<body> 
    <script type="IN/Login" data-onAuth="onLinkedInAuth"></script> 
</body> 

但我不知道,如果你的第二個腳本做得正確,因爲我不知道LinkedIn的API的工作原理。

0
<head> 
<script type="text/javascript" src="http://platform.linkedin.com/in.js"> 
    api_key: YOUR_API_KEY 

</script> 
</head> 
<body> 
<script type="IN/Login"> 
    Hello, <?js= firstName ?> <?js= lastName ?>. 
</script> 
</body> 
相關問題