Using javascript, I'm trying to figure out how to pass a JSON Serialized array that contains multiple arrays, as a parameterized URL.
I've read multiple related articles on StackOverflow -- but they only addressed very basic singular arrays.[1]
[1] How to pass an array as a URL parameter?
Here's the context surrounding my specific use case, which involves two separate websites (A & B) that are on two separate domains:
Website A:
This website has shopping cart functionality that uses javascript, AJAX, jQuery, and utilizes localStorage to store product(s) that are added to the shopping cart.
Once the user is ready to checkout -- we redirect them over to Website B to complete the checkout process.
Example Shopping Cart Data:
The serialized JSON data below shows data for two separate products. Each product has 6 unique keys associated with it.
[
{
"cid":"68",
"d":"12/26/2020",
"tti":"75687708",
"tt":"0800",
"tn":"1",
"q":"4"
},
{
"cid":"67",
"d":"01/09/2021",
"tti":"75688769",
"tt":"0909",
"tn":"1",
"q":"2"
}
]
What the end result URL could potentially look like:
Website B:
This website will parse the URL using PHP in order to get the details of each product to process further (ie: product lookup and validation, etc).
Once the product(s) are validated the checkout page is populated and the user can complete payment and checkout.