简体   繁体   English

从jQuery地址选择器返回街道名称

[英]Return street name from jquery addresspicker

I am using the addpresspicker 我正在使用addpresspicker

link to ui.addresspicker.js 链接到ui.addresspicker.js

and i have gotten everything to work as expected. 而且我已经按预期工作了。 I have gotten the results returned into each individual section as in the demo 我已经将结果返回到演示中的每个部分

xilinus.com/jquery-addresspicker/demos/index.html xilinus.com/jquery-addresspicker/demos/index.html

but am missing the Street Name. 但缺少街道名称。

I am using this as a means of providing the correct address on a webform and those details need to be formatted into a CSV file ready to be imported to another program after the form is submitted. 我将其用作在Web表单上提供正确地址的一种方式,并且这些详细信息需要格式化为CSV文件,准备在提交表单后导入到另一个程序中。

What's the better way to do this? 什么是更好的方法呢? As every address is different each time, i'm not sure running validation on the full address to extract the street name and type (eg First Street) would be my best option. 由于每个地址每次都不同,因此我不确定在全地址上运行验证以提取街道名称和类型(例如第一街)是否是我的最佳选择。

I found another post on here that looks like it returns the street name (long_name component) using a JSON call to the google maps API but assumes you have the lat and long already then extracts the street name from that but I can't find the question now to reference it. 我在这里找到了另一篇文章,看起来它使用对google maps API的JSON调用返回了街道名称(long_name组件),但假设您拥有lat并且long已经从中提取出街道名称,但是我找不到现在提出问题以供参考。

Example shown below. 示例如下所示。 I want to be able to separate Park Avenue and have it put in the street name box. 我希望能够分隔Park Avenue并将其放在街道名称框中。

http://i.stack.imgur.com/prFGD.jpg http://i.stack.imgur.com/prFGD.jpg

SOLVED. 解决了。

You haven't provided any sample code so a guess of what you're missing is in the options when you initialize the extension. 您尚未提供任何示例代码,因此在初始化扩展程序时,可以在选项中猜测丢失的内容。 Add a value for the route element and assign it the id of the element for the street name in your page. 为route元素添加一个值,并在页面中为其分配街道名称的元素ID。

elements: {
       :
      route: #add-the-id-of-your-element-here,
       :
  },

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM