私は実際に誰かがここでこれを手伝ってくれることを願っています。私はこの週末の間、このコードを動作させるために取り組んできました。そして、私は上司に月曜の朝まで働くことを約束します。EventListenerで関数を呼び出す
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<!--<script type="text/javascript" src="http://code.jquery.com/jquery-1.5b1.js"></script>-->
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
api_key: my_API_key
authorize: true
onLoad: shareContent
</script>
</head>
<body>
<script type="in/Login"></script>
<script>
// Setup an event listener to make an API call once auth is complete
function onLinkedInLoad() {
IN.Event.on(IN, "auth", shareContent);
}
// Handle the successful return from the API call
function onSuccess(data) {
console.log(data);
}
// Handle an error response from the API call
function onError(error) {
console.log(error);
}
// Use the API call wrapper to share content on LinkedIn
function shareContent() {
// Build the JSON payload containing the content to be shared
var payload = {
"comment": "Check out developer.linkedin.com! http://linkd.in/1FC2PyG",
"visibility": {
"code": "anyone"
}
}
IN.API.Raw("/people/~/shares?format=json")
.method("POST")
.body(JSON.stringify(payload))
.result(onSuccess)
.error(onError);
}
</script>
</body>
</html>
私はLinkedInのボタンでサインを取得し、このコードを実行するUPDATE。ここをクリックするとLinkedInにログインします。私がログインしているときに空白のページが表示され、コンソールにエラーが表示されません:
しかし、どのようにして共有機能をポップアップ表示できますか?
を?それは関数の引数ですか? – Kannaj
こんにちはKunkka。私は実際にそれを100%保証していません。 apiにあります:https://developer.linkedin.com/docs/share-on-linkedin –
ドキュメントに指定されたin/login部分がありませんか? '' '' '' – Kannaj