Hello list,

I found a solution now via OpenLayers.Request.GET.

If somebody else might have the same problem, it works well with that code;

------>
  
    map.events.register('click', map, function (e) {

                    var url =  wms.getFullRequestString({
                                    REQUEST: "GetFeatureInfo",
                                    EXCEPTIONS:  
                                    "application/vnd.ogc.se_xml",
                                    BBOX: wms.map.getExtent().toBBOX(),
                                    X: e.xy.x,
                                    Y: e.xy.y,
                                    INFO_FORMAT: 'text/html',
                                    QUERY_LAYERS: wms.params.LAYERS,
                              WIDTH: wms.map.size.w,
                                    HEIGHT: wms.map.size.h});
                                   

           
        function handler(request) {

    answer=request.responseText.length;
        if (answer==1) {
url=special_url_for_no_results;
 new_window(url);

         }else {
   new_window(url);
    }
         
         }

var request = OpenLayers.Request.GET({
    url: url,
    callback: handler
});
   

              });

Best regards, Kai
-------- Original-Nachricht --------
> Datum: Mon, 23 Feb 2009 17:32:51 +0100
> Von: "Kai Behncke" <[email protected]>
> An: [email protected]
> Betreff: [OpenLayers-Users] Handling of empty getFeatureInfoResults

> Dear list,
> 
> 
> I have got a question to the handling of "empty" getfeatureinfo-results.
> 
> 
> The "core" of getfeatureinfo.html (in the examples) is:
> 
>             var url =  wms.getFullRequestString({
>                             REQUEST: "GetFeatureInfo",
>                             EXCEPTIONS: "application/vnd.ogc.se_xml",
>                             BBOX: wms.map.getExtent().toBBOX(),
>                             X: e.xy.x,
>                             Y: e.xy.y,
>                             INFO_FORMAT: 'text/html',
>                             QUERY_LAYERS: wms.params.LAYERS,
>                             WIDTH: wms.map.size.w,
>                             HEIGHT: wms.map.size.h});
>             OpenLayers.loadURL(url, '', this, setHTML);
>             OpenLayers.Event.stop(e);
>       });
>     function setHTML(response) {
>         OpenLayers.Util.getElement('nodeList').innerHTML =
> response.responseText;
>     }
> 
> 
> It works nice if I click on an existing wms-point.
> 
> I wonder how to handle a empty "non-existing-response" (that comes if I
> click beside a wms-point).
> 
> I try to write a function (new_window(url)) that opens a new window with
> an entry "You clicked besides the point" (or, if not, the result of the
> wms-point).
> 
> like :
> 
>          function setHTML(response,url) {
>       //"non existing response" -> click besides a point
>       if (response.responseText.length==1) {
>  
>         url='http://noresult_url';
>          new_window(url);
>        } 
> //response -> click on a point
> else 
> {
>     new_window(url);
> }
> }  
> 
> 
> But the problem is: I don`t get it to transport the url to the function
> "setHTML", so that setHTML works with that ajax-response AND(!) the url.
> 
> Has anybody an idea how to solve/handle that?
> 
> Thank you very much, Kai
> -- 
> Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen:
> http://www.gmx.net/de/go/multimessenger01
> _______________________________________________
> Users mailing list
> [email protected]
> http://openlayers.org/mailman/listinfo/users

-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: 
http://www.gmx.net/de/go/multimessenger01
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to