0

I have this code on my homepage to make it possible to search for an event in The Events Calendar. But at the moment when I click the submit button the search query opens in a new tab, I want the query to be in the same tab. How to solve this? I've tried window.open(url,'_self'); but it's not working.

<form>
<div class="form-group">
<input type="text" class="form-control" id="eventInput" placeholder="Sök efter något">
</div>
<button type="submit" class="btn btn-default" id="eventSearch">Submit</button>
</form>

<script type="text/javascript">
jQuery(document).ready(function($) {

$('#eventSearch').on('click', function () {
    var searchInput = $('#eventInput').val();
    var url = "/scala/forestallningar/lista/?tribe-bar-search=" + searchInput + "&hide_subsequent_recurrences=1";
    window.open(url);
});

});
</script>

EDIT: When I try window.location(url); a "?" is only added to the page url

AndreasA
  • 1
  • 1

0 Answers0