title: Can't get value of element in my success function using ajax ?
body: <p>so I am having a problem i dont know how to solve it, I spent hours just trying to find a way to get my value of my element.</p>
  
  <p>Here is my code (jsp) : </p>
  
  <pre><code>&lt;div class="aimerSection"&gt;
       &lt;div class="aime"&gt;
       &lt;form&gt;
       &lt;input type="hidden" class="adore1" name="aime" value="${post.id}"&gt;
       &lt;input type="button" class="adore2" value="J'aime"&gt;
       &lt;/form&gt;
       &lt;/div&gt;
       &lt;c:if test="${ post.adore == 0 || post.adore == 1 }"&gt;
       &lt;div class="nbreAimes"&gt;&lt;p&gt;&lt;span class="nbrAdore"&gt;${ post.adore }&lt;/span&gt; personne aime ça&lt;/p&gt;&lt;/div&gt;
       &lt;/c:if&gt;
  
       &lt;c:if test="${ post.adore != 0 &amp;&amp; post.adore != 1 }"&gt;
       &lt;div class="nbreAimes"&gt;&lt;p&gt;&lt;span class="nbrAdore"&gt;${ post.adore }&lt;/span&gt; personnes aiment ça&lt;/p&gt;&lt;/div&gt;
       &lt;/c:if&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>What i want to achieve is to get the value of my 'p' in the div with 'nbreAimes' when i click my button ( input type button )  so that's my jquery file : </p>
  
  <pre><code>$(document).ready(function(){
  $(".adore2").click(function(){
      var aime = $(this).parent().find(".adore1").val()
      var value = $(this).parent().parent().siblings().find(".nbrAdore").text()
      alert(value)
  
      console.log("value : "+$(this).parent().parent().siblings().find("p").text());
      $.ajax({
          type:"POST",
          data: {aime:aime},
          url:"acceuilServlet",
          success:function(result){
  
              console.log("in functions : "+$(this).parent().parent().siblings().find("p").text());
          }
      })
  
  })
  })
  </code></pre>
  
  <p>But the problem is that I am getting the value correctly, but inside the function of ajax ( success : function ) i copied exactly the same code and I get nothing .. </p>
  
  <p>in my console I see : </p>
  
  <pre><code>value : 1 personne aime ça 
  in functions : 
  </code></pre>
  
  <p>i get Nothing. </p>
  
  <p>Hope I am going to find some help. 
  Thank you. </p>