< >

select-auswahl.php


Quell Code


<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<title>select lösung</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<label>amount</label>
<input type="text" id="amount"><br>
<label>article-details</label>
<input type="text" data-productkey="irgendwas" id="article-details"><br>
<label>size</label>
<select id="size" name="size">
    <option value="s">S</option>
    <option value="m">M</option>
    <option value="l">L</option>
    <option value="xl">XL</option>
</select><br>
<label>user_id</label>
<input type="text" id="user_id"><br>
<input type="button" class="toCart" value="Senden">
<div id="notify"></div>

<script>
$( document ).ready(function() {  
    $('.toCart').on("click", function() {
    console.log('Button fired');
        var amount         = $('#amount').val();
        var productkey     = $('#article-details').attr('data-productkey');
        var size           = $('#size').val();
        var user_id        = $('#user_id').val();
       console.log('Vor Ajax = '+size);
        $.ajax({
            url: "loesungen/index.php?ordner=löoesungen&name=add2.cart.php",
            type: "GET",
            data: {
                amount:     amount,
                size:         size,
                productkey: productkey,
                user_id:    user_id
            },
            success: function(data) {
            console.log(data)
                //$("#notify").html(data);  
            }
        });
    });
});
</script>
</body>
</html>