0

I'm working on a project which requires me to search a list of items based on an input from a search field- to this end I am required to pass a variable from url to a javascript variable. Would this involve PHP or can this be done plainly in Javascript? I am a bit new to web development so thank you for the patience of any answerers.

  • This can be done with JS or PHP. – Luca Kiebel Jan 28 '22 at 17:14
  • 2
    Please research your inquiry before posting here. Duplicate of [How can I get query string values in JavaScript?](https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript) – esqew Jan 28 '22 at 17:14
  • Is there a way to add an event listener for the url in js? – developer_dude Jan 28 '22 at 17:19
  • @developer_dude That would be an entirely separate question from the one you’ve posed here, and would depend on a bunch of environmental factors for which you haven’t provided details for here. What events are you specifically seeking to listen for as it relates to the URL of the page? Generally, when the URL changes, an entirely new page is loaded from the server or an intermediary cache - JavaScript event listeners on one page would not be a good fit for watching for these types of events. – esqew Jan 28 '22 at 17:27

0 Answers0