javascript – 是什么原因导致maps.googleapis.com/maps/vt返回400错误?

前端之家收集整理的这篇文章主要介绍了javascript – 是什么原因导致maps.googleapis.com/maps/vt返回400错误?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我目前正在使用带有Fusion Table Layer的Google Map.通过这张地图,我制作了填充地图的 AJAX查询和一个包含结果的列表.

最近,谷歌地图API响应出现了400“格式错误的请求”错误.在设置过滤器并通过AJAX发送后,在使用新结果集填充地图时偶尔会发生此响应.在检查错误Firefox的调试控制台时,我注意到pb参数可能是问题.问题是我不确定这个参数到底有什么错误.

这是错误输出的GET请求:

https://maps.googleapis.com/maps/vt?pb=[...insert_param_code_here...]&callback=_xdc_._n2pwun&token=20077

我将我看到的内容粘贴到下面的pb参数中.这是在发出其中一个“无效”查询时发送的内容.

"!1m4!1m3!1i13!2i2042!3i3139!1m4!1m3!1i13!2i2043!3i3139!1m4!1m3!1i13!2i2042!3i3140!1m4!1m3!1i13!2i2042!3i3141!1m4!1m3!1i13!2i2043!3i3140!1m4!1m3!1i13!2i2043!3i3141!1m4!1m3!1i13!2i2042!3i3142!1m4!1m3!1i13!2i2042!3i3143!1m4!1m3!1i13!2i2043!3i3142!1m4!1m3!1i13!2i2043!3i3143!1m4!1m3!1i13!2i2044!3i3139!1m4!1m3!1i13!2i2045!3i3139!1m4!1m3!1i13!2i2046!3i3139!1m4!1m3!1i13!2i2044!3i3140!1m4!1m3!1i13!2i2044!3i3141!1m4!1m3!1i13!2i2045!3i3140!1m4!1m3!1i13!2i2045!3i3141!1m4!1m3!1i13!2i2044!3i3142!1m4!1m3!1i13!2i2044!3i3143!1m4!1m3!1i13!2i2045!3i3142!1m4!1m3!1i13!2i2045!3i3143!1m4!1m3!1i13!2i2046!3i3140!1m4!1m3!1i13!2i2046!3i3141!1m4!1m3!1i13!2i2046!3i3142!1m4!1m3!1i13!2i2046!3i3143!2m21!1e2!2sft:tableID!4m2!1ssg!2s%20Cities_With_Charters%20%3D%20'East%20St.%20Louis%20Area'%20AND%20Students_Served%20LIKE%20'%25'%20AND%20School_Type_Dropdown%20IN%20('Charter')%20ORDER%20BY%20School_Name%20ASC!4m2!1ssc!2sSchool_Info_ID%2C%20CPS_ID%2C%20RCDTS%2C%20School_Name%2C%20Street_Address%2C%20City%2C%20State%2C%20Zip%2C%20Phone%2C%20Website%2C%20Lat%2C%20Long%2C%20Year_Opened%2C%20School_Description%2C%20District_Info_ID%2C%20District_Name%2C%20Charter_Renew_YR%2C%20Network_ID%2C%20Network%2C%20Community_Area%2C%20State_Rep_District%2C%20State_Sen_District%2C%20Ward_Remapped%2C%20Grades_Served%2C%20Grades_Capacity%2C%20Serves_ES%2C%20Serves_HS%2C%20Serves_MS%2C%20Serves_Dropouts%2C%20School_Type_Dropdown%2C%20School_Type_Color%2C%20School_Type_Display%2C%20Profile_Type%2C%20SQRP_Rating%2C%20SQRP_Profile%2C%20Cities_With_Charters%2C%20Link_IIRC%2C%20Students_Served!4m2!1ssq!2s'School_Type_Color'%20%3D%20'GREEN'$'School_Type_Color'%20%3D%20'ORANGE'$'School_Type_Color'%20%3D%20'BLUE'$'School_Type_Color'%20%3D%20'MAGENTA'!4m2!1sc!2si:grn_blank$i:orange_blank$i:ltblu_blank$i:purple_blank!4m2!1sy!2s2!4m2!1stmplt!2s2!5i1!3m3!2sen-US!3sUS!5e18!4e3!12m1!5b1"

以下是没有URL编码的查询仅供参考:

SELECT School_Info_ID,CPS_ID,RCDTS,School_Name,Street_Address,City,State,Zip,Phone,Website,Lat,Long,Year_Opened,School_Description,District_Info_ID,District_Name,Charter_Renew_YR,Network_ID,Network,Community_Area,State_Rep_District,State_Sen_District,Ward_Remapped,Grades_Served,Grades_Capacity,Serves_ES,Serves_HS,Serves_MS,Serves_Dropouts,School_Type_Dropdown,School_Type_Color,School_Type_Display,Profile_Type,SQRP_Rating,SQRP_Profile,Cities_With_Charters,Link_IIRC,Students_Served FROM tableID WHERE Cities_With_Charters = 'East St. Louis Area' AND Students_Served LIKE '%' AND School_Type_Dropdown IN ('Charter') ORDER BY School_Name ASC

到目前为止我采取的步骤来解决这个问题:

>确保发送到Fusion Tables的任何查询字符串都已使用URL编码发送.
>确保检查我的引号和引号,并确保在发送的查询中没有任何流浪的.
>检查我的Google Map init参数,以确保我没有输入任何拼写错误添加任何不存在的参数.

在确保格式不正确的内容未发送时,是否还有其他预防措施?

解决方法

我通过打开Chrome开发者工具解决了这个问题,并转到:应用程序> <清除存储>清除网站数据.然后,在开发人员工具仍然打开的情况下,单击并按住浏览器左上角的刷新按钮,直到看到“清空缓存和硬重新加载”字样.点击那个,你很高兴.

猜你在找的JavaScript相关文章