postGet (JS API v2)
Version 2 API only.
postGet
Method Signature |
void ultraCart.util.postGet(String url); |
Description |
|
Parameters |
String url - the complete url that needs POSTing |
Result |
no return value. after the submit, the page will change. |
This method is commonly used to POST the redirect url during cart finalization to prevent the user from hitting the back button (so easily).
Here is a code snippet from a checkout() button implementation.
ultraCart.saveFieldElements(function (){ ultraCart.checkout(checkoutMethod || ultraCart.checkouts.CHECKOUT_ULTRACART, {async:true, onComplete:function(result){ if(result.redirectToUrl){ ultraCart.util.postGet(result.redirectToUrl); // post instead of redirect to discourage back button use. } else if(result.errors) { finalizing = false; renderErrors(result.errors); } else { finalizing = false; // ?? this should never happen. } }}) });