title: Alter text in Button after Ajax call
body: <p>I'm hitting some trouble in trying to change the text in a button after a user clicks on the wishlist link. The Ajax call is working successfully right now and the data is updated correctly in the DB, currently the function displays a notification pop up in the browser when a user clicks on wishlist, but I would like to change the &quot;wishlist&quot; part of the button to &quot;Added to wishlist&quot; after a successful submission.</p>
  <p>EDIT:</p>
  <p>I have added <code>$(&quot;#btn span&quot;).text(&quot;Added to wishlist&quot;);</code></p>
  <p>But it's still not working.</p>
  <pre><code>function wish($p_id){
      var w_id = $p_id;
      var email = $(&quot;.wish&quot;).data(&quot;user&quot;);
  
      if(email != 0){
          $.ajax({
              url:&quot;function.php&quot;,
              method:&quot;post&quot;,
              data:{w_id:w_id,email:email},
              success: function($wish){
                  if($wish &gt; 0){
                      notif({
                          msg:&quot;Product Already Added to wishlist!!!&quot;,
                          type:&quot;warning&quot;,
                          width:330,
                          height:40,
                          timeout:1000,
                      })
                  }else{
                     $(&quot;#btn span&quot;).text(&quot;Added to wishlist&quot;); 
                      notif({
                          msg:&quot;Added to wishlist&quot;,
                          type:&quot;success&quot;,
                          width:330,
                          height:40,
                          timeout:1000,
                      })
                  }
              }
          })
      }
  }
  </code></pre>
  <p>and the HTML part</p>
  <pre><code>&lt;a href='$add_wish' id=&quot;btn&quot;class='btn btn-default add-to-cart wish' data-user='$s_email' onclick='wish($id)'&gt;
      &lt;i class='glyphicon glyphicon-heart'&gt;&lt;/i&gt; Wishlist
  &lt;/a&gt;
  </code></pre>