开发者

Facebook Javascript SDK share to facebook wall

开发者 https://www.devze.com 2023-04-13 03:01 出处:网络
I am getting an error: \'share\' is not a member of \'ASP.default2_aspx\'. OnClick of Button1, I need this data TxtLocation, TxtDistance, Date to be shared on Facebook. Its very similar to \'Run with

I am getting an error: 'share' is not a member of 'ASP.default2_aspx'.

OnClick of Button1, I need this data TxtLocation, TxtDistance, Date to be shared on Facebook. Its very similar to 'Run with friends app' Simulate the same as Run with friends app'. So would it be possible to use a fb.ui stream_publish method on click of Button1 with all the three text box vales. This is what I have in default.aspx

            //stream publish method
            function streamPublish(name, description, hrefTitle, hrefLink, userPrompt) {
                FB.ui(
                {
                    method: 'stream.publish'开发者_开发问答,
                    message: '',
                    attachment: {
                        name: name,
                        caption: '',
                        description: (description),
                        href: hrefLink
                    },
                    action_links: [
                        { text: hrefTitle, href: hrefLink }
                    ],
                    user_prompt_message: userPrompt
                },
                function (response) {

                });

            }


            function share() {
                var share = {
                    method: 'stream.share',
                    u: 'http://thinkdiff.net/'
                };

                FB.ui(share, function (response) { console.log(response); });
            }


        </script>


        <p><fb:login-button autologoutlink="true" perms="email,user_birthday,status_update,publish_stream"></fb:login-button></p>

   <form id = "form1" runat="server">

    <div id="Event" runat="server">
        <h1>
            Add your event</h1>
        <table>
            <tr>
                <td>
                    Where did you go
                </td>
                <td>
                    <asp:TextBox ID="TxtLocation" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    Number of miles
                </td>
                <td>
                    <asp:TextBox ID="TxtDistance" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    Date(MM/DD/YYYY)
                </td>
                <td>
                    <asp:TextBox ID="TxtDate" runat="server">TxtDate</asp:TextBox>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:Button ID="Button1" runat="server" Text="Add Distance"  onclick="share();return false" BackColor="Blue" />
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>


Maybe it's because share is already the name of the function.

Try changing the name of the var inside the function share.

Bye ;)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号