Streaming live at 10am (PST)

Get Order id from url to a form input

Hey,

I am looking for a way to add the order id in an input, on order confirmation page.

Then it allow client to send a file and upload it directly in airtable


Here is my site Read-Only: LINK
(how to share your site Read-Only link)

Actually my embed code is
<script type="text/javascript"> var urlParams = new URLSearchParams(window.location.search); var orderId = urlParams.get('orderId'); </script> <input id="orderId" name="orderId" data="orderId">

ok, i think i got a way to do this:

<input type="hidden" id="custId" name="custId" value="">

<script>
function getParameter() {
  var searchString = window.location.search.substring(1),
      i, val, params = searchString.split("&");
 
  for (i=0;i<params.length;i++) {
    val = params[i].split("=");
    if (val[0] == "orderId") {
      return val[1];
    }
  }
  return null;
}
var elem = document.getElementById("custId");
 elem.value = getParameter();
</script>