[Mapbender-dev] JS exceptions
Marc Jansen
jansen.marc at gmx.de
Tue Jan 9 08:35:35 EST 2007
Hey there,
Christoph Baudson schrieb:
> Hello again,
>
> thanks for your input Marc.
>
> Returning a boolean sounds like a sensible thing to do. At the moment
> the php-class doesn't return a value either, so I will go and edit it
> as well.
>
Thats nice. Is the online browsable version of the SVN-repository down
at the moment?
> I believe you, Marc, are quite experienced in Ajax, so I will ask
> rightaway: What is the best way to return the value? I would send http
> headers in mb_js_exception.php and just echo 'true' or 'false'. Is
> this the way it is done? Or do I have to build an XML?
>
I am not that experienced, I just experimented a little bit here and there.
There is yet another common habit: returning a JSON-object which
indicates success or failure.
Which way you choose is mainly a result of personal preferences.
For the discussed action (loggin of an exception), all of the above
mentioned things would work well... I'd choose the simplest thing by
echoing the status as 'true' or 'false' (It might be wrapped in some
rudimentary XML):
<?xml version="1.0" encoding="ISO-8859-1"?>
<loggingresponse>
<loggingresult>true</loggingresult>
</loggingresponse>
(Easy to process with my favorite library, too --> jquery)
As for XML in general: In my opinion returning a well-formed XML is in
this case more important than follow some sort of DTD.
The JSON-thing would be wonderful, too. Some additional properties could
be returned as string literal of an object, e.g. {loggingresult: 'true',
loggingdate: '2007-01-09', ...}, eval'ed, and could be used afterwards.
> Christoph
>
> Marc Jansen schrieb:
>> Hi list,
>>
>> this is IMHO a good approach!
>>
>> However: How about having a callback function when the AJAX-request
>> has completed? One might want to react on the logging of the error.
>> Most frameworks for AJAX-stuff provide this functionality. Is this
>> worth a consideration? BTW: What does the function return right now?
>> According to your snippet nothing? What about a boolean - this could
>> then be used to determine further script logic, and might as well
>> replace the callback-function-thing.
>>
>> -- Marc
>>
>> Christoph Baudson schrieb:
>>> Hi developers,
>>>
>>> today I added a new class for handling Javascript exceptions to
>>> map.php. Until today, I only alerted error messages, which is a bit
>>> awkward once a software is delivered. Check this out:
>>>
>>> http://www.mapbender.org/index.php/Talk:For_developers#Javascript_exceptions
>>>
>>>
>>> Is this a sensible approach? Please comment and I'll add it to the SVN.
>>>
>>> Cheers, Christoph
>>> _______________________________________________
>>> Mapbender_dev mailing list
>>> Mapbender_dev at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapbender_dev
>>>
>>
>> _______________________________________________
>> Mapbender_dev mailing list
>> Mapbender_dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapbender_dev
>
> _______________________________________________
> Mapbender_dev mailing list
> Mapbender_dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapbender_dev
>
More information about the Mapbender_dev
mailing list