javascript - Nightsbridge 预订日历,提交表单后将输入值发送到重定向页面
问题描述
我正在研究一种简单的代码和平,以便在提交表单后将输入值发送到重定向页面。
但是我完成脚本的技能有点太基础了,我希望下面的脚本重定向如下:
在此生成“签入和签出输入字段”的表单:
<form class="form book-now-form" role="form" id="widget_booking_form" name="widget_booking_form">
<input id="action" type="hidden" value="2" name="action"> <input id="clone_id" type="hidden" value="1111" name="bbid">
<!--check in element-->
<div class="form-group">
<label for="check-in">Check In</label> <!-- <input type="textfield" class="form-control" id="check-in" placeholder="12.20.2014"> -->
<input type="text" class="form-control" id="start-date" name="startdate" placeholder="mm/dd/yyyy">
</div>
<!--check out element-->
<div class="form-group">
<label for="check-out">Check Out</label> <!-- <input type="textfield" class="form-control" id="check-out" placeholder="12.27.2014"> -->
<input type="text" class="form-control" id="end-date" name="enddate" placeholder="mm/dd/yyyy" >
</div>
<!--submit-->
<div class="form-group">
<button name="Submit" href="#" class="btn btn-sm btn-warning">Search</button>
</div>
</form>
这里用 JS 生成日历和日期:
$( document ).ready(function() {
$( function() {
var dateToday = new Date();
var dates = $("#start-date, #end-date").datepicker({
defaultDate: "+2d",
changeMonth: true,
numberOfMonths: 1,
minDate: dateToday,
onSelect: function(selectedDate) {
var option = this.id == "start-date" ? "minDate" : "maxDate",
instance = $(this).data("datepicker"),
date = $.datepicker.parseDate(instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings);
dates.not(this).datepicker("option", option, date);
}
});
});
});
但是使用上面的代码,脚本会错误地生成输入值(日期)以及所有输入变量。
所以我现在需要使用以下变量格式将页面重定向到 nightsbrige 的桥( https://www.nightsbridge.co.za/bridge/book )
?action=2&bbid=1111&startdate=2018-05-08&enddate=2018-05-09
并不是?action=2&bbid=1111&startdate=05%2F16%2F2018&enddate=05%2F23%2F2018&Submit=
任何帮助将不胜感激:) 一旦此代码被修复,它将可以免费使用。
解决方案
推荐阅读
- reactjs - 在带有真实后端的 React 应用程序中添加简单的身份验证
- .net-core - 无法加载 Microsoft.VisualStudio.Coverage.Interop.dll - Azure CI 管道 - YAML
- html - 使用 VBA 单击使用 documentID 的链接
- javascript - 猫鼬 findOneAndUpdate 在 for 循环中使用 set if extist 或 put if doesn't
- java - 带矩阵的文件 IO
- terraform - 在动态块内对多个块进行 Terraform?
- python - 我应该为生产环境禁用 BroswableAPIRenderer 吗?
- rust - 有没有一种内存有效的方法来改变固有实现的行为?
- arrays - 测试数组中的对象数
- cmake - 如何使用 CMake 为目标安装 python 文件(包括依赖目标的 python 文件)?