I need to get data with click to link.
There are my links;
<a class="note" id="' . $data["p_id"] . '" value="1" href="javascript:void(0)">+1</a>
<a class="note" id="' . $data["p_id"] . '" value="-1" href="javascript:void(0)">-1</a>
I’m using this code with using $.ajax. I have to get value and “$data[“p_id”]” but my usage is true or false?
And my JQuery code:
$("a[class=note]").click(function( evt ){
var note = $(this).attr("value");
var preid = $(this).attr("id");
alert(note);
$.ajax({
type: 'GET',
url: 'style/ajax.php',
data: 'do=note&value=' + note + '&preid=' + preid
});
});
Some points
falsefromclickhandlers to prevent the default actionajaxis a low-level method, consider get or postinputs orbuttons instead.Example: