[OpenLayers-Commits] r11346 - sandbox/camptocamp/mobile/openlayers/examples

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Wed Feb 23 11:02:26 EST 2011


Author: pgiraud
Date: 2011-02-23 08:02:26 -0800 (Wed, 23 Feb 2011)
New Revision: 11346

Modified:
   sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.js
Log:
Don't call geonames if search is empty

Modified: sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.js
===================================================================
--- sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.js	2011-02-23 16:01:02 UTC (rev 11345)
+++ sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.js	2011-02-23 16:02:26 UTC (rev 11346)
@@ -42,13 +42,15 @@
     });
     $('#searchpage').live('pageshow',function(event, ui){
         $('#query').bind('change', function(e){
+            $('#search_results').empty();
+            if ($('#query')[0].value === '') {
+                return;
+            }
             $.mobile.pageLoading();
 
             // Prevent form send
             e.preventDefault();
 
-            $('#search_results').empty();
-
             var searchUrl = 'http://ws.geonames.org/searchJSON?featureClass=P&maxRows=10';
             searchUrl += '&name_startsWith=' + $('#query')[0].value;
             $.getJSON(searchUrl, function(data) {



More information about the Commits mailing list