J0k3R^
  • *****


      Reputation : 11
      Registered on : 2014-04-25
      Posts : 153
      Love Fmcodes
    I got this code to delete topic posts without reload the page
    Spoiler:

    Code:
    $(function () {
       $(".post a[href*='mode=delete'][href*='p='][href*='tid=']").click(function (a) {
          a.preventDefault();
          var b = $(this).closest(".post");
          !0 == confirm("Are you sure you want to delete ?") && $.post(this.href, {
             confirm: 1
          }, function (a) {
             b.slideUp(function () {
                b.remove();
                $(".main-content.topic .post").length || location.replace($(".nav[href^='/f']:last")[0].href)
             })
          })
       });
    });


    But the problem is that i need to remove the .pun .posthead too because as u see at the image, when i delete a post the .pun .posthead with the username is still there:


    Delete Post Problem Rspg072

    Tommy Lee
    • ****


        Reputation : 0
        Registered on : 2014-05-29
        Posts : 54
        Love Fmcodes
      What code did you use?

      Niko
      • Administrator

          Reputation : 319
          Registered on : 2012-02-22
          Posts : 2366
          School of codes courses: coming soon
        Hello

        try this code:
        Code:
        $(function () {
          $(".post a[href*='mode=delete'][href*='p='][href*='tid=']").click(function (a) {
              a.preventDefault();
              var b = $(this).closest(".post");
              !0 == confirm("Are you sure you want to delete ?") && $.post(this.href, {
                confirm: 1
              }, function (a) {
                b.slideUp(function () {
                    b.remove();
                    $(".main-content.topic .post, .main-content.topic .posthead").length || location.replace($(".nav[href^='/f']:last")[0].href)
                })
              })
          });
        });

        if it doesn't work, provide me the link of the topic where you have the issue of the screenshot :bene:



        Niko wants you in the team Guest

        Community manager and Administrator at Forumattivo.com

        J0k3R^
        • *****


            Reputation : 11
            Registered on : 2014-04-25
            Posts : 153
            Love Fmcodes
          @Niko
          its still the same result, i gave an account via pm, use it to post something and then delete it to see the problem :)

          Niko
          • Administrator

              Reputation : 319
              Registered on : 2012-02-22
              Posts : 2366
              School of codes courses: coming soon
            I haven't received the datas



            Niko wants you in the team Guest

            Community manager and Administrator at Forumattivo.com

            J0k3R^
            • *****


                Reputation : 11
                Registered on : 2014-04-25
                Posts : 153
                Love Fmcodes
              okey could now check it?

              Niko
              • Administrator

                  Reputation : 319
                  Registered on : 2012-02-22
                  Posts : 2366
                  School of codes courses: coming soon
                actually you still have that bar only since you don't reload the page

                mmh, the best way would be editing templates



                Niko wants you in the team Guest

                Community manager and Administrator at Forumattivo.com

                J0k3R^
                • *****


                    Reputation : 11
                    Registered on : 2014-04-25
                    Posts : 153
                    Love Fmcodes
                  yeah..
                  but what should i do there? i thought its possible to add some code to the js so the bar get removed too

                  Niko
                  • Administrator

                      Reputation : 319
                      Registered on : 2012-02-22
                      Posts : 2366
                      School of codes courses: coming soon
                    no, it isn't possible

                    but on the other forum I told you how to do it



                    Niko wants you in the team Guest

                    Community manager and Administrator at Forumattivo.com

                    J0k3R^
                    • *****


                        Reputation : 11
                        Registered on : 2014-04-25
                        Posts : 153
                        Love Fmcodes
                      ah, sorry i forgot to leave feedback.
                      i finally solved this problem :)