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
Post a Comment