3

I answered a question yesterday that had been put on-hold for no MCVE.

The OP (a new member) needed a little instruction and with some editing help the question had sufficient information to provide a definitive answer as to why his code wasn't working.

Note: this is the only version I could pull from Google Cache

I'm trying to change the text inside of a button in the click event after an ajax request has completed successfully.

For some reason I am unable to update the text.

Jquery:

  $(".addfriend").click(function(){
     $.ajax({
        type: "POST",
        url: "/pages/send_friend_request.php",
        data: {userid: $(this).data('userid')},
        success: function(data) {
           if(data == 'success')
              $(this).html(' Request Sent');
           else
              alert('Error: Could not send request. > Report this to admin.');
        }
     });
  });

HTML Button:

<button class="addfriend" data-userid="<?=$member['id']?>" type="button" name="button">+Add as Friend</button>

The reason why the text isn't being updated is because the use of $(this) within the ajax callback without providing context or a reference.

No, the question is not a gem and could've used some more editing, but, it is an answerable question that was on-topic, so, why was it deleted?

4
  • 1
    It seems the question was deleted because the OP was deleted. In the timeline, there is "User 6248787 deleted" and the question was deleted by Community.
    – Tunaki
    Apr 25, 2016 at 21:58
  • 1
    Yeah, but, shouldn't the question just be disassociated with the OP's account? The question had an accepted answer. To be clear, I'm not real worried about the rep, just hate seeing on-topic, answered questions deleted.
    – matt.
    Apr 25, 2016 at 21:59
  • No, it was negatively scored. See point 10 here meta.stackexchange.com/a/5222 The system will automatically delete any question (and its answers) or answer with a negative score when its owner’s account is deleted.
    – Tunaki
    Apr 25, 2016 at 22:00
  • Ouch, that's rough. Thanks for the info @Tunaki. Would you mind posting that as an answer?
    – matt.
    Apr 25, 2016 at 22:01

1 Answer 1

2

The question was deleted because:

  • The OP's account was deleted;
  • The question was negatively scored.

From the How does deleting work? FAQ (point 10):

The system will automatically delete any question (and its answers) or answer with a negative score when its owner’s account is deleted.

This can also be seen in the timeline of the post:

enter image description here

The fact that the question had an accepted answer apparently isn't taken into account.

3
  • FYI, I cannot see the timeline. I am a mere mortal <10k.
    – matt.
    Apr 25, 2016 at 22:05
  • 2
    @ᴉʞuǝ Hence the screenshot. I never lose an occasion to have a nice red circle :).
    – Tunaki
    Apr 25, 2016 at 22:06
  • 7
    Specifically, I deleted the account because it was the third account of a question-ban-evading user who had taken to insulting members of the site. They are no longer welcome to participate on this site, and will find it much more difficult to create a new account from their current location.
    – Brad Larson Mod
    Apr 25, 2016 at 22:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .