谷歌地图-难以理解的Javascript错误消息
google maps - Javascript error messages difficult to understand
当我使用Chroms的JavaScript工具查看时,我在这个页面上看到了许多JavaScript错误消息。我很难理解为什么会发生这种事。这是页面:
http://www.comehike.com/outdoors/parks/trailhead.php
知道它有什么问题吗?
谷歌控制台:
未捕获类型错误:无法读取nulltrailhead.php的属性"documentElement":84
trailhead.php:
request.onreadystatechange = function()
{
if (request.readyState == 4)
{
var xmlDoc = request.responseXML;
...
// obtain the array of markers and loop through it
markers = xmlDoc.documentElement.getElementsByTagName("marker");
xmlDoc为null,这意味着请求没有接收到任何内容或没有接收到有效的XML。事实证明是后者:
trailhead_ajax.php:
This page contains the following errors:
error on line 21 at column 2381: attributes construct error
Below is a rendering of the page up to the first error.
在任何情况下,属性构造错误都是因为您有(为了易读性而在此处格式化):
<marker trailhead_name="Parrish Creek Trail"
trailhead_description="From Interstate 15 take Centerville exit 319.
Go east on Parrish Lane. At 700 East turn left
at the "T." Follow the narrow road to the
trailhead." />
您必须将"T."
转义为"T."
。
老实说,这些错误信息并不难理解。如果说有什么不同的话,那就是它们非常有帮助。
我看到的一个问题是AJAX请求接收到无效的XML。有些引号没有转换为HTML实体。
XML Parsing Error: not well-formed Location: moz-nullprincipal:{ae7bee0f-3857-5344-ac34-31cd2a941e51} Line Number 21, Column 5841:
...t on Parrish Lane. At 700 East turn left at the "T." Follow the narrow road t...
...-------------------------------------------------^
在尝试访问数据之前,您需要确保您的ajax调用状态良好
if (request.readyState == 4 && request.status == 200)
此外,您的xml响应不是格式良好的
http://www.comehike.com/outdoors/parks/trailhead_ajax.php给出错误。
相关文章:
- JavaScript错误:Microsoft JScript运行时错误:应为对象
- 将字符串拆分为数组时出现JavaScript错误
- 处理JSON字符串会导致JavaScript错误
- 使用AJAX在剑道网格中分组时出现Javascript错误
- Ajax对web URL的调用导致javascript错误
- 为什么当我尝试在Ionic中使用列表时会出现此JavaScript错误
- 可以't解决Javascript错误
- django出现神秘的javascript错误
- JavaScript错误无效的限定符
- 使用主题运行时portlet liferay时出现Javascript错误
- 绑定函数时在IE7中未实现Javascript错误
- Javascript错误:未捕获引用错误:未定义编辑
- eventListener出现JavaScript错误
- sharepoint站点的internet explorer中出现Javascript错误
- LoadControl HttpCompileException自定义服务器控件JavaScript错误
- 销毁Bootstrap popover时出现Javascript错误
- 无法加载Javascript错误XMLHttpRequest
- 使用JSON.parse时出现无效字符javascript错误
- 修复Javascript错误
- 模板字符串上的netbeans javascript错误(backticks)