Reputation:
Does anyone know why this isn't working?
$(".v1").click(function(){
$.post("inc.php?action=vote&id="$(this).attr('id')"&vote=1");
});
$(".v2").click(function(){
$.post("inc.php?action=vote&id="$(this).attr('id')"&vote=2");
});
Thanks,
Upvotes: 0
Views: 77
Reputation: 50573
You need to concatenate the string to your variable content, using +
operator, like this:
$.post("inc.php?action=vote&id=" + $(this).attr('id') + "&vote=1");
Upvotes: 1
Reputation: 10880
You missed the +
between concatenations
$(".v1").click(function(){
$.post("inc.php?action=vote&id=" + $(this).attr('id') + "&vote=1");
});
$(".v2").click(function(){
$.post("inc.php?action=vote&id=" + $(this).attr('id') + "&vote=2");
});
Upvotes: 3