Trying to use data()
<p>I have this code:</p>

<pre><code>$('.solicitud_amistad').click(function(){
    var aux =  $(this);
    console.log($(this));
    console.log($(this).data('receptor'));
    $.post('amistad/nueva' , {id_receptor:$(this).data('receptor')},
        function(response){
            aux.replaceWith(response)
        }
    );
});
</code></pre>

<p>and I'm getting this output:</p>

<pre><code>&lt;a class="solicitud_amistad" data-receptor="4"&gt;Enviar solicitud de amistad&lt;/a&gt;
undefined
</code></pre>

<p>I expected a <code>4</code> instead of <code>undefined</code>.</p>
