php - Send AJAX Request with Query String -


i have standard hyperlink 2 query strings send php form seen below:

echo ' <strong>(<a id="cancel-upgrade" href="unsubscribe.php?cu='.$payref.'&su='.$stripe_subscription_id.'">cancel upgrade)</a></strong>'; 

the way know how send data via ajax is:

$.post('process-payment.php', $("form#payment-form").serialize(), function (data) {     if (data == "success") {         ...something     else {         else     } }); 

is there anyway use link have , use query string data, via ajax, php form , act on success/error messages received?

you can add query string parameters post request request. example:

$.post('process-payment.php?somekey=somevalue&anotherkey=anothervalue', //... 

so if you're echoing values php might like:

$.post('process-payment.php?cu=<?php echo $payref; ?>&su=<?php echo $stripe_subscription_id; ?>', //... 

(or of several ways emit text php page.)


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -