window.location.replaceis the way to go if you need http redirection. However, if you want to save the history (the current back button of the browser), it will be best for you to choose one of window.locationor window.location.href. If this is a one-page application, you can also consider window.location.hashfor hashed URL changes.
To get the value of the switch, you can try
$('input[type=radio]').on('change', function(e) {
});
For jquery based solution:
$('input[type=\'radio\']').on('change', function(e) {
$(location).attr('href', this.value);
});
gashu source
share