Here's a fiddle that will give you exactly what you asked for: http://jsfiddle.net/9Le00jtw/
$("#formone").submit( function() {
document.location.assign( "http://onlinereservation.html#!" + "/" + $("input[name=date_from]").val() + "/" + $("input[name=date_to]").val() + "/adults:" + $("select[name=adults]").val() + "/children:" + $("select[name=children]").val() );
return false;
});
Here's a fiddle for the way that I would do it: http://jsfiddle.net/xLmsb1xo/1/
Now I realize that you want to use the backslash character to separate each value, however, probably the easiest way and, indeed, the most common/standard way is to use the syntax "?variable=", that's why this code is modeled after that. It makes it much easier to parse out variables from the url. You'll notice in the code that i set it up to display as a simple alert() message. In order to link to the page instead of alerting, you would replace alert() with document.location.assign()
JavaScript:
window.onload = function() {
$("#formone").submit( function() {
/* when user hits the submit button do following */
alert( window.location.href + "?datefrom=" + $("input[name=date_from]").val() + "?dateto=" + $("input[name=date_to]").val() + "?adults=" + $("select[name=adults]").val() + "?children=" + $("select[name=children]").val() );
*/get the window location and add "?variable=" then the value of
the input or select box for that variable a.e. ?dateto=04-17-2015 */
return false;
});
}
In the above code we get the location of the current window using window.location.href and then we append the variables to it, with a variable name and then the value of the appropriate input/select boxes using their name attributes. The selector syntax is tagname[attr=text] - so if we're trying to find an input box with the name bingo, we would use this selector in jQuery $("input[name=bingo]") and if we were looking for a selection box with the name banana we would do use this selector $("select[name=banana]")
HTML:
<form method="POST" id="formone">
<!-- we added the method="POST" so that the browser knows what to do with
the form when the submit button is tapped and the id so that we can identify
it -->
<div>Adults</div>
<div>
<select name="adults">
<option selected="selected" value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</div>
</div>
<div>
<div>Children</div>
<div>
<select name="children">
<option selected="selected" value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</div>
</div>
<div>
<div>Check-in date</div>
<div>
<input name="date_from" value="16-04-2015" type="text"></div>
</div>
<div>
<div>Check-out date</div>
<div><input name="date_to" value="17-04-2015" type="text"></div>
</div>
<div>
<input value="Check Availability" type="submit">
</div>
</form>
EDIT: I added "return false;" to the submit() function. The reason why is because we need to tell the form to stop trying to submit and to process the script as is, this will allow a redirect.