过滤结果而不是替换它们?
我正在使用 fusion 开发 google Map Api。我有多个搜索查询并希望它们过滤结果。目前,他们互相推翻,并且不一起工作来过滤结果。该网站名为 earthquakedamagemap.com。这是我的大学项目。任何帮助将不胜感激。
我认为需要更改的是“value.replace”属性?
function changeMap2() {
var searchString = document.getElementById('search-string2').value.replace(/'/g, "\\'");
if(!searchString) {
layer.setQuery("SELECT 'Latitude' FROM " + tableid);
return;
}
layer.setQuery("SELECT 'Latitude' FROM " + tableid + " WHERE 'Updated Risk Assessment:' = '" + searchString + "'");
}
I am working on a google Map Api using fusion. I have multiple search queries and want them to filter the results. At the moment they overrule each other and don't work together the filter the results. The site is called earthquakedamagemap.com. It is my university project. Any help would be much appreciated.
I think it is the 'value.replace' attribute which needs changing?
function changeMap2() {
var searchString = document.getElementById('search-string2').value.replace(/'/g, "\\'");
if(!searchString) {
layer.setQuery("SELECT 'Latitude' FROM " + tableid);
return;
}
layer.setQuery("SELECT 'Latitude' FROM " + tableid + " WHERE 'Updated Risk Assessment:' = '" + searchString + "'");
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发布了一些示例代码:
不久前在这篇文章中。您只需将搜索条件与 AND 组合起来,并仅使用多个搜索条件调用一次 layer.setQuery 。我认为这与您的替换调用没有任何关系,因为我没有在您的输入值中看到任何嵌入的单引号。
埃里克
I posted some example code:
in this post not too long ago. You need to combine your search conditions with AND and call layer.setQuery with multiple search conditions only once. I don't think it has anything to do with your replace call as I didn't see any embedded single quotes in your input values.
Eric