txt3rob
1
i have the following
<script type="text/javascript">
$(document).ready(function() {
$("button").click(function(event) {
alert(event.target.id);
});
});
</script>
This tells me the id of the button that has been pressed.
how would i add a $post request to index.php?id= with the value of the id?
txt3rob
2
got
<script type="text/javascript">
$(function(){
$("button").on("click", function(){
var myId = $(this).attr("id");
$.post( "index.php?id="+myId);
});
});
</script>
but i need a way to capture this as $_POST[‘’]; is not
txt3rob
3
fixed but $_POST & $_GET are empty for some silly reason
<script type="text/javascript">
$(function(){
$("button").on("click", function(){
var myId = $(this).attr("id");
$.post( "index.php?id="myId, {id:myId} );
});
});
</script>