Skip to content

Instantly share code, notes, and snippets.

@dannymichel
Last active December 22, 2015 19:09
Show Gist options
  • Save dannymichel/6517543 to your computer and use it in GitHub Desktop.
Save dannymichel/6517543 to your computer and use it in GitHub Desktop.
i have a file called wantbtn.php that has this in it
<?php $wantclick = mysql_query("INSERT INTO user (itemtype, totalcost, karmacost, imagename. namebrand, wantedstatus)
SELECT itemtype, totalcost, karmacost, imagename. namebrand, wantedstatus
FROM allitems")
or die(mysql_error());
?>
when you click wantIt, i want the above to happen
This is the JS I tried
<script>
$('.item').each(function(){
$('.wantIt', this).click(function(e){
e.preventDefault();
$.post(
'includes/wantbtn.php'
);
});
});
</script>
@heshanh
Copy link

heshanh commented Sep 11, 2013

<script> $(function(){ $('.wantIt').click(function(e){ e.preventDefault(); $.post( 'includes/wantbtn.php' ); }); }); </script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment