Skip to content

Commit

Permalink
prefill concept
Browse files Browse the repository at this point in the history
  • Loading branch information
SH20RAJ committed Apr 1, 2024
1 parent a423c67 commit f56a235
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
const urlParams = new URLSearchParams(window.location.search);
function getParameterByName( name ){
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return decodeURIComponent(results[1].replace(/\+/g, " "));
function getParameterByName(name) {
if (name !== "" && name !== null && name != undefined) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
} else {
var arr = location.href.split("/");
return arr[arr.length - 1];
}

}
function extractIdFromUrl(url) {
// Define the pattern to match the ID in the URL
Expand Down

0 comments on commit f56a235

Please sign in to comment.