so i have eg
- <a href="#?name=kristof&id=1" class="send">Kristof</a>
<a href="#?name=bart&id=2" class="send">Bart</a>
- $(function()
{
$.ajaxSetup({
cache: false
});
var aanTladen = '<div style="color:#4DC2F9"><img src="load.gif"/> Searching for results : </div>';
$('.send').click(function(){
$.ajax(
{
type: "POST",
url: "test2.php",
// data: ({name : $(this).text(), id : $(this).text()}),
data: ({id : this.getAttribute('id')}),
success: function(msg)
{
console.log(msg);
$('#result').html(msg);
}
});
});
});
So this is nog working and i know that normal but i don't know how to do it.
I just want those variables that are added to the link into the data: in de js-script.
Can someone explain it to me please? I think i might need to create an onclick function? but then how to "split" them?