【发布时间】:2021-12-14 02:05:26
【问题描述】:
我编写了一个返回以下内容的 API
<location><lat>41.47033705</lat><lon>-81.93612862</lon></location>
<location><lat>41.470320224762</lat><lon>-81.9364535808563</lon></location>
<location><lat>41.4704650640488</lat><lon>-81.9449239969254</lon></location>
<location><lat>41.4780235290527</lat><lon>-81.8454140424728</lon></location>
<location><lat>41.48597253</lat><lon>-81.82579113</lon></location>
我有一个 AJAX 调用来获取它,现在我需要在我的 JavaScript 中使用它。
最后我想和 2d Array [lat,lon]
最少的代码量是多少?
【问题讨论】:
-
正则表达式。
-
这就是我没有尝试的原因stackoverflow.com/questions/1732348/…
-
你在用jquery吗?
-
@abc123 假设这只是 JavaScript 和 Ajax。
-
@AMR 您的 XML 定义明确,因此执行正则表达式是安全的。
标签: javascript ajax parsing