-1

I have a map that's internal so I can't show it, but this example shows the kind of text search that I have: http://gmaps-samples.googlecode.com/svn/trunk/fusiontables/change_query_text_input.html

When the user searches for something with zero results, I would like a simple JavaScript alert box to pop up. Or some other way of letting the user know the search is working, there just aren't any results for his search. In the example linked above, nothing happens if there are no search results, which isn't very user-friendly.

Can somebody give me a code snippet to accomplish that for the linked example?

Thanks!

jumpyg
  • 3
  • 3

2 Answers2

0

Try the following:

if(yourVariableForResults === null || yourVariableForResults === "" || yourVariableForResults === 0){
    alert("No results have been found");
}
  • Yes, but how do I get the number of results in the Google Fusion Talbes example I linked to? I need code that relates directly to that example. I don't know how to get the number of results. – jumpyg Sep 01 '15 at 14:53
0

The linked example uses a FusionTablesLayer, a FusionTablesLayer doesn't give any information about the result of the Query.

You'll need to send a query by using the REST-API (JSONP is supported) to get details like e.g. the number of rows

Dr.Molle
  • 116,463
  • 16
  • 195
  • 201