populate Wpform from url

PHOTO EMBED

Fri Oct 22 2021 13:28:15 GMT+0000 (UTC)

Saved by @khalidlogi #php

<script>
jQuery(document).ready(function($) {
  
  $.urlParam = function (name) {
    var results = new RegExp('[?&]' + name + '=([^&#]*)')
                      .exec(window.location.search);

    return (results !== null) ? results[1] || 0 : false;
}

console.log($.urlParam('id')); //registration
console.log($.urlParam('email')); //bobo@example.com
    var email = decodeURI($.urlParam('email'));
var replaced = email.replace("%40", "@"); 
  var type = decodeURI($.urlParam('type'));

  var replaced2 = type.replace("+", " ");  

  $("#wpforms-2228-field_0").val($.urlParam('id'));
    $("#wpforms-1770-field_4").val(replaced);
    $("#wpforms-1770-field_6").val("Suite a votre demande de devis  nous vous prions de trouver ci joint notre proposition de tarif pour   '" + replaced2 +  "'.... ");


  })
</script>
content_copyCOPY