php form textarea text on facebook share when click on button

∥☆過路亽.° 提交于 2020-01-22 02:33:04

问题


i have form and in form text area and submit button
when i click on submit button and share data taken homepage banner and text not textarea text

<form id="facebook-form" method="post">
<ul class="form-list">
    <li>
        <label for="facebook-content"><?php echo $this->__("Post on Facebook") ?>:</label>
        <div class="input-box">
            <textarea id="affiliate-facebook-content" class="required-entry"><?php echo $this->getDefaultSharingContent() ?></textarea>
        </div>
    </li>
</ul>
<div class="buttons-set">
    <button type="button" class="button" title="<?php echo $this->__('Post on Facebook') ?>" onclick="postOnFacebook();">
        <span><span><?php echo $this->__('Post on Facebook') ?></span></span>
    </button>
</div>

my javascript code:

function postOnFacebook() {
    if (facebookForm.validator.validate()){
        var params = Form.serializeElements($('facebook-form').select('input, select, textarea'));
        var url = '<?php echo $this->getUrl("affiliates/refer/test") ?>';

        var message = $('facebook-content').value
                            // calling the API ...
        if(message) {
            // alert(message);
            var obj = {
                method: 'feed',
                link: $('personal_affiliate_url').href,
                description: message
            };

            function callback(response) {
                if (response && response.post_id) {
                    $('affiliate-facebook-msg').show();
                }
                else{
                    alert('This message hasn\'t been posted successfully!');
                }
            }
            FB.ui(obj, callback);
        }
    }
}

Any help would be appreciated.

Thanks.

来源:https://stackoverflow.com/questions/57680369/php-form-textarea-text-on-facebook-share-when-click-on-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!