Skip to content

Instantly share code, notes, and snippets.

@lizardking8610
Created April 28, 2019 03:38
Show Gist options
  • Save lizardking8610/0c07bbd7498b722682278ab7c82dba38 to your computer and use it in GitHub Desktop.
Save lizardking8610/0c07bbd7498b722682278ab7c82dba38 to your computer and use it in GitHub Desktop.
(function ( $ ) {
// Create two datepickers.
$( '#mer_checkin' ).datepicker({ dateFormat: 'mm/dd/yy' });
$( '#mer_checkout' ).datepicker({ dateFormat: 'mm/dd/yy' });
// Prevent mobile devices from launching a keyboard on input focus.
$( "#mer_checkin, #mer_checkout" ).attr( 'readonly', 'readonly' );
$( "#mer_checkin, #mer_checkout" ).click( function( event ){
$( this ).removeAttr('readonly').select();
});
$( "#mer_checkin, #mer_checkout" ).blur( function( event ){
$( this ).attr( 'readonly', 'readonly' );
});
// Compile the string and redirect.
$( '#check_availability' ).on( 'click', function( event ) {
event.preventDefault();
// Date needs to be in format: mm/dd/yyyy
var propertyIDString = 'propertyID=' + $( '#propertyID' ).val();
var checkinString = '&checkin=' + $( '#mer_checkin' ).val();
var checkoutString = '&checkout=' + $( '#mer_checkout' ).val();
var adultsString = '&adults=' + $( '#adults' ).val();
// Remove promotion code at client request, they may want it back.
// var codeString = '&promo=' + $( '#promo' ).val();
var codeString = '';
var baseUrl = 'https://res.windsurfercrs.com/ibe/index.aspx?';
var actionString = baseUrl + propertyIDString + checkinString + checkoutString + adultsString + codeString;
window.location.href = actionString;
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment