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

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -