javascript - How to pass php switch case data through html form using ajax? -
action="cart.php?action=add&code=<?php echo $product_array[$key]["code"]; ?>"
this form action i'm trying send data php code based on action switch cases present here "code" 1 of them.
i'm not able figure out how send switch case data.
you can way, if want on submit.
$( "#form" ).submit(function( event ) { $.ajax({ method: "get", url: "cart.php", data: { action: "add", code: "<?php echo $product_array[$key]['code']; ?>" } }) .done(function( msg ) { alert( "product added: " + msg ); }); event.preventdefault(); });
Comments
Post a Comment