http://localhost:52717/ticketwizard/eventfeed/0/5868?keywordsearchstring=eventkeyword how do i get keywordsearchstring value form this adress in javascript

You can use the URLSearchParams constructor in JavaScript to get the value of the keywordsearchstring parameter in the URL. Here's an example:

index.tsx
// Get the URL string
let urlString = "http://localhost:52717/ticketwizard/eventfeed/0/5868?keywordsearchstring=eventkeyword";

// Create a new URL object from the URL string
let url = new URL(urlString);

// Get the value of the 'keywordsearchstring' parameter
let keyword = url.searchParams.get("keywordsearchstring");

console.log(keyword);
// Output: eventkeyword
368 chars
12 lines

In the code above, we first create a URL object from the URL string. Then, we use the searchParams property of the URL object to get the value of the keywordsearchstring parameter using the get method. Finally, we log the value of the keyword variable to the console.

related categories

gistlibby LogSnag