我正在使用ajax,我想以某种方式将当前页面的url转换为用于ajax方法的数据对象。我正在使用window.location.search
获取页面的当前URL,但不确定将URL转换为用于Ajax的数据对象的最佳方法。
URL(window.location.search):
?pickup-location=Orlando+Intl+Airport+%28MCO%29%2C+FL&dropoff-location=&pickup-date=07%2F16%2F2018&pickup-time=12%3A00&dropoff-date=07%2F17%2F2018&dropoff-time=12%3A00&discount-code-company=&pagination=1
最终目标:
data: {
pickup-location: "Orlando+Intl+Airport",
.... etc ...
pagination: page
},