•  · 6 friends

[Resolved] Page refreshes whenever the button is clicked

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.

0 0 0 0 0 0
  • 126
Replies (3)
  • Change this

    bx_alert(oData.msg, fContinue);  

    For this:

    bx_alert(oData.msg);  


    0 0 0 0 0 0
    • Hi I have tried this but the page is still refreshing

      0 0 0 0 0 0
      • Proceed to developer>navigation then click on edit item on the new button that you have created. After that, write javascript:void(0) in the link field and click save. Clear all caches and try it, it will not refresh anymore. Thank you!

        0 0 0 0 0 0
        Not logged in users can't 'Comments Post'.
        3
        1
        Added:
        Category:

        UNA - Social Media Software Framework

        Close