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

Popular posts from this blog

cookies - Yii2 Advanced - Share session between frontend and mainsite (duplicate of frontend for www) -

angular - password and confirm password field validation angular2 reactive forms -

php - Permission denied. Laravel linux server -