[mapserver-users] Re: interesting thread on JSON-ish output from MapServer

Steve Lime sdlime at gmail.com
Sun Sep 11 20:10:48 PDT 2011


The forward could be to a JavaScript file with an empty object. Browser should follow ok...

Sent from my iPad

On Sep 11, 2011, at 4:58 PM, Mr. Puneet Kishor <punk.kish at gmail.com> wrote:

> 
> On Sep 11, 2011, at 4:18 PM, Steve Lime wrote:
> 
>> You could try the web object and the empty parameter.
> 
> 
> From TFM
> 
> EMPTY [url]
> URL to forward users to if a query fails. If not defined the value for ERROR is used.
> 
> 
> Hmmmm... I am not sure I want to forward the user to any URL. This is all Ajax, so I have to receive an empty data structure. I guess I could try exploiting the jQuery `$.ajax({ error: function() { popup an infowindow with regrets message } });`
> 
> 
> 
> 
>> 
>> Sent from my iPad
>> 
>> On Sep 11, 2011, at 1:33 PM, "Mr. Puneet Kishor" <punk.kish at gmail.com> wrote:
>> 
>>> 
>>> On Sep 11, 2011, at 12:46 PM, Steve Lime wrote:
>>> 
>>>> 
>>>> 
>>>> Sent from my iPad
>>>> 
>>>> On Sep 11, 2011, at 9:36 AM, Mr. Puneet Kishor <punk.kish at gmail.com> wrote:
>>>> 
>>>>> Partial solution (phew, for now), but other problems persist --
>>>>> 
>>> 
>>> ..
>>> 
>>>>> 
>>>>> 
>>>>> One issue I have not solved -- if no result is found, MapServer sends back the following --
>>>>> 
>>>>> ----
>>>>> <HTML>
>>>>> 
>>>>> <HEAD><TITLE>MapServer Message</TITLE></HEAD>
>>>>> 
>>>>> <!-- MapServer version 6.0.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=GEOS INPUT=POSTGIS INPUT=GDAL INPUT
>>>>> =SHAPEFILE -->
>>>>> 
>>>>> <BODY BGCOLOR="#FFFFFF">
>>>>> 
>>>>> msQueryByPoint(): Search returned no results. No matching record(s) found.
>>>>> 
>>>>> </BODY></HTML>
>>>>> ----
>>>>> 
>>>>> 
>>>>> Well, that gums up the works. I really want MapServer to just send an empty JSON structure, something like foo({}). Suggestions on how I can prevent this HTML message from MapServer, and force it to use the template instead?
>>> 
>>> 
>>> Any suggestion for the above? That is, force MapServer to not send back an error message of the above kind. Instead, send back an empty JSON structure based on the template?
>>> 
>>> 
>>> Puneet.
> 



More information about the MapServer-users mailing list