0

How can I make jquery run that $_GET. I'm trying to remove "Refreshing a page" and that is why I'm trying to use jQuery.

if (isset($_GET['add'])) {
    global $db;
    $quantity = $db->query('SELECT id, quantity FROM data WHERE id = '.$_GET['add']);
    while ($r = $quantity->fetch()) {
        if ($r['quantity'] != $_SESSION['data_'.(int)$_GET['add']]) {
            $_SESSION['data_'.(int)$_GET['add']]+= '1';
        }
    }
<script>
$( ".wasd" ).click(function( event ) {
    event.preventDefault();
    $( "<div>" )
        .append( "$_GET add function" )
        .appendTo( "#log" );
});
</script>
fusion3k
  • 11,568
  • 4
  • 25
  • 47
Ul.Ender
  • 21
  • 2

1 Answers1

0

Example ajax get request using jQuery:

$.get( "url_of_php_here?add=" + id, function( data ) {
      $( ".result" ).html( data );
      alert( "Load was performed." );
});
Hilmi Erdem KEREN
  • 1,949
  • 20
  • 29