I have created a toggle button with jquery but I need to pass my $id so it can execute the mysql in toggle_visibility.php.
how do I pass my variable from my tag ?
<a class="toggleVisibility">Yes</a>
<script>
$("a.toggleVisibility").toggle(
function () {
$(this).html("No");
},
function () {
$.ajax({
type: "POST",
url: "toggle_visibility.php",
data: "id<?=$id; ?>",
success: function(msg){
alert( "Data Saved: " + msg );
}
});
$(this).html("Yes");
}
);
</script>