<script> (function (d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/zh_TW/sdk.js#xfbml=1&version=v2.3"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> <script type="text/javascript"> var AppId = ""; $(document).ready(function () { $.ajax({ cache: false, type: "Post", async: false, url: "/ExternalAuthFacebook/GetAppId", complete: function (data) { if (data.responseText != "") { AppId = data.responseText; return false; } else { AppId = '83325854470829935'; } } }); }); window.fbAsyncInit = function () { FB.init({ appId: AppId =="" ? '825854472220829935' : AppId, cookie: true, // enable cookies to allow the server to access // the session xfbml: true, // parse social plugins on this page version: 'v2.0' // use version 2.0 }); } function checksharestate1(activityid, activitypicurl, SharlFPlusUrl, Title,ActivityTime) { ShareFbFunction(activityid, activitypicurl, SharlFPlusUrl, Title,ActivityTime); } function ShareFbFunction(activityid, activitypicurl, SharlFPlusUrl, Title,ActivityTime) { //登陆之后则进行分享 FB.ui({ method: 'feed', name:Title, caption:ActivityTime, link:SharlFPlusUrl, picture:activitypicurl, description: '', }, function (response) { if (response != null) { // alert("分享"); $.ajax({ cache: false, type: "GET", dataType: "json", contentType: "application/json;charset=utf-8", url: "/Activity/BuildShareHistory", data: { Activityid: activityid }, complete: function (data) { //返回根据文件名查询的值; var result = data.responseText.toString(); if (result == "1") {//分享成功; return false; } } }); } }); } </script>
facebook分享购物的代码测试
最新推荐文章于 2023-11-06 23:36:29 发布