Re: add parameter to settings onAjaxError/ajaxErrorHandler

Johan Brichau <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.seaside
Message-ID <[email protected]>
Hi Sabine,

The settings object you get in the global ajax error handler is the one passed to the ajax call that is the origin of the error.
From Seaside, this object is in the ‘options’ instVar of any JQAjax instance. Hence:

html jQuery ajax
	…
	optionAt: ‘suppressErrors’ put: <someJavaScriptValue>;

would do the trick.

Mind that this means the value for ‘suppressErrors’ is being generated when your page is rendered.
So, if the value depends on a runtime value, registering a function and calling that will be necessary.

Hope this helps
Johan

> On 6 Feb 2017, at 11:57, Sabine Manaa <[email protected]> wrote:
> 
> Hi,
> 
> I have a working solution for redirect the user to the login page as
> described here [1][2][3].
> 
> In short words:
> I add addLoadScript: html jQuery document onAjaxError: (self
> ajaxErrorHandler asFunction: #('event' 'jqxhr' 'settings' 'exception')))
> with >>ajaxErrorHandler
> ^ ' if (jqxhr.status == 403) { 
>   alert("Logoff text......."); 
>   window.location.href = settings.url.split("?")[0].replace("help",""); 
>   } else { 
>   if (jqxhr.status == 200) { } else {  
>   alert("error text.....: " + exception +"jqxhr.status:"+jqxhr.status); }}'
> 
> I want to add one more point as described here:
> http://stackoverflow.com/a/7462590/2611391
> 
> I want to suppress this error message dialog in one certain case with
> something like this:
> if(settings.suppressErrors) {
>        return;
>    }
> 
> So my question is how can I add a value like 'suppressErrors' to my settings
> object so that in the ajaxErrorHandler I can ask for
> 'settings.suppressErrors'... 
> 
> Regards
> Sabine
> 
> [1]http://forum.world.st/Custom-error-handler-for-Seaside-expiration-and-AJAX-errors-WAS-Re-Seaside-AJAX-script-amp-html-vs-o-td4916950.html
> [2]http://forum.world.st/Improved-HTML-error-handler-td4927552.html#a4927734
> [3]http://forum.world.st/Ajax-requests-not-redirecting-to-Login-page-after-session-timeout-td4802509.html#a4802521
> 
> After logoff AND deleting the users account
> 
> 
> 
> --
> View this message in context: http://forum.world.st/add-parameter-to-settings-onAjaxError-ajaxErrorHandler-tp4933109.html
> Sent from the Seaside General mailing list archive at Nabble.com.
> _______________________________________________
> seaside mailing list
> [email protected]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[email protected]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.