Skip to:

How to control redirect behavior after reply submit??

  • huetherb


    I suppose this isn’t WordPress or BBPress specific, but trying to figure out if there is a WordPress way of doing this.

    I am using BBPress, and on some page, such as, I have a block with a link to a discussion topic. That link is of form

    <a href="javascript:void(0);" data-target="#myModal" data-href="" data-toggle="modal" class="openPopup"><h3 class="topictype-title">required discussion 1</h3></a>

    The modal popup is handled in bootstrap via

    <div class="modal fade" id="myModal" role="dialog">
       <div class="modal-dialog modal-xl">
          <div class="modal-content">
             <div class="modal-header"><button type="button" class="close" data-dismiss="modal">×</button><h4 class="modal-title">Class Discussion</h4>
             <div class="modal-body"></div><div class="modal-footer"><button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

    And with jQuery

        $('body').on('click', '[data-toggle="modal"]', function(){
            $($(this).data("target")+' .modal-body').load($(this).data("href"));

    What happens now, is after hitting submit, the modal goes away, and the forum topic page with the submitted reply is loaded: url

    The thing is, after user submits from the modal, I want either

    **1) the refresh (so, going to to happen in the modal, or**

    **2) for the modal to simply close and user is returned to exactly as they were prior to modal popping up, that is, to**

    Ideas on how to ideally achieve these two behaviors? I have never worked with modals before, so curious what are some best practices here to get the desired behavior.


  • You must be logged in to reply to this topic.
Skip to toolbar