cmt

  • 23
zhalkiar added a discussion to , cmt

Dear developers,

As I was experimenting with the code, I tried to replicate another function that is in BxDolCmts.js whereby the codes for the replicated function can be seen below.


BxDolCmts.prototype.cmt2 = function(e, iCmtId) {

    var $this = this;

    var oParams = $this._getDefaultActions();

    console.log(JSON.stringify($this._sActionsUrl));

    oParams['action'] = 'Hide';

    oParams['Cmt'] = iCmtId;

    jQuery.post (

        $this._sActionsUrl,

        oParams,

        function(oData) {

            var fContinue = function() {

                if(oData && oData.id != undefined) {

                    $(e).parents('.bx-popup-applied:first:visible').dolPopupHide();

                    $('' + oData.id).bx_anim('hide', $this._sAnimationEffect, $this._iAnimationSpeed, function() {

                        var oCounter = $(this).parent('ul.cmts').siblings('.cmt-cont').find('.cmt-actions a.cmt-comment-replies span');

                        if(oCounter)

                            oCounter.html(oCounter.html() - 1);

                        $(this).remove();

                        location.reload();

                    });

                }

            };

            $this._loadingInContent(e, false);

            if(oData && oData.msg != undefined)

            {

                bx_alert(oData.msg, fContinue);  

            }

            else

                fContinue();

        },

        'json'

    );

};


I found out that, in the bold portion of the code, even when I have returned an error message the page still refreshes automatically instead of just showing the bx_alert and don't refresh at all. I would like to achieve the behavior of just displaying the the alert and do not want any refreshing of the page when there is an alert been displayed due to an error. May I know how may I achieve that, as it is currently refreshing every time I clicked the button that has been linked to this functions. Even when I have commented the logic applied in the onclick function and cleared all cache, as long as the button is pressed it is refreshing the page.