0

I have a URL ending with #/, and I want to add the URL parameters that are selected in a select list to the URL and remove the #/ from URL.

$('#drop').on('change', function(e) {
  if (e.handled !== true) {
    e.handled = true;

    var url = 'https://www.geoplug.docksal/sales/rentals#/';
    // window.location.href = url + '?sort=' + this.value;
    console.log(url + '?sort=' + this.value);
  }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<select id="drop">
  <option selected>Open this select menu</option>
  <option value="1">One</option>
  <option value="2">Two</option>
  <option value="3">Three</option>
</select>

3
  • Which part are you having trouble with? replace()? Commented May 18, 2021 at 13:24
  • Obviously the parameters part of your script works, so I assume that you're asking just about removing the two characters. That's been addressed many times before. See the links above. Commented May 18, 2021 at 13:39
  • FYI, you were missing quotes around your URL. Not sure whether that was tripping you up. Commented May 18, 2021 at 13:39

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.