[Mapbender-dev] JS exceptions

Marc Jansen jansen.marc at gmx.de
Thu Jan 11 07:11:37 EST 2007


Christoph Baudson schrieb:
> Hi Marc,
>
> thanks for your fast reply.
>
>> try this (untested as usual):
>>
>> function Mb_exception(message) {
>>     return mb_ajax_post('../php/mb_js_exception.php', {text:message}, 
>> function(text, status){
>>         return (text == "true") ? true : false;
>>     });
>> }
>
> at the moment I'm using jQuery. 
Wonderfull!

Which version? There's a beta version of 1.1, the stable should be 
released on January 14th, as this is jquerys first birthday.
> Does its function 'post' return a value? I didn't find that in the 
> source code.
>

It should (!) return the XMLHttpRequest, so one can manually abort it 
(at least $.ajax() does so, I think, $.post is just an alias of a 
$.ajax() with certain parameters).
> Mapbender uses an Ajax wrapper:
>

That's a perfect solution. I think a mentioned that before...
> function mb_ajaxWrap_post(url, param, callback) {
>     $.post(url, param, callback);
> }
>
> Would I just add the return there as well?
>
yes, the value should than be returned from inner function to the 
outmost function

> function mb_ajaxWrap_post(url, param, callback) {
>     return $.post(url, param, callback);
> }
>
> If it does work: Will the JS be halted until the callback function 
> answers?
>

With jquery you have the option of setting global ajax-parameters:
$.ajaxSetup( {setting:'value', foo:'bar', ...} );

if you pass in an object like the following, the JS will be halted while 
the post request remains unanswered:
var myAJAX_settings = {type:'POST', async:true};

> A lot of questions :-)
>

I love giving in my 2 cents.
> Thanks for your patience
>

No patience needed!
> Christoph
>
> _______________________________________________
> Mapbender_dev mailing list
> Mapbender_dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapbender_dev
>


-- Marc



More information about the Mapbender_dev mailing list