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>
isherwood
  • 58,414
  • 16
  • 114
  • 157
vyshnavi
  • 167
  • 1
  • 3
  • 16
  • Which part are you having trouble with? [replace()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)? – freedomn-m May 18 '21 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. – isherwood May 18 '21 at 13:39
  • FYI, you were missing quotes around your URL. Not sure whether that was tripping you up. – isherwood May 18 '21 at 13:39

0 Answers0