Jquery Toggle & passing data
Posted
by Ross
on Stack Overflow
See other posts from Stack Overflow
or by Ross
Published on 2010-04-18T09:41:57Z
Indexed on
2010/04/18
9:43 UTC
Read the original article
Hit count: 437
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 ?
Yes
$("a.toggleVisibility").toggle( function () { $(this).html("No"); }, function () { $.ajax({ type: "POST", url: "toggle_visibility.php", data: "id", success: function(msg){ alert( "Data Saved: " + msg ); } }); $(this).html("Yes"); } );© Stack Overflow or respective owner