jorgebastida / django-dajax

Easy to use library to create asynchronous presentation logic with django and dajaxice
http://dajaxproject.com/
BSD 3-Clause "New" or "Revised" License
346 stars 99 forks source link

Unknown action in jquery.dajax.core.js #2

Closed jonathonadler closed 13 years ago

jonathonadler commented 14 years ago

When an error occurs it is generally unrecoverable, however an error message is repeated over and over on the client. I sugest adding the return statement below:

            default:
                alert('Unknown action!');
                return false; // error reported, exit each loop
jorgebastida commented 14 years ago

What version of dajax do you have? Check the last commit. http://github.com/jorgebastida/django-dajax/blob/master/src/prototype.dajax.core.js#L6 If there is any exception in the server alert once and go away.

jorgebastida commented 14 years ago

The current jquery.dajax.core.js works fine Upgrade your copy and it should work.

jonathonadler commented 14 years ago

thank you!

gerdemb commented 13 years ago

I'm still seeing this issue with jquery on 0.8.4. Looking at the source, it doesn't seem fixed...

gerdemb commented 13 years ago

Thinking about this more, following the JavaScript gracefully degradation philosophy wouldn't it be better to simply hide this message entirely except when in a debugging mode? I usually see this message when there is an error in my Django view which Dajax tries to interrupt as a JavaScript command. On most browsers this creates and endless series of "Invalid Action" alerts that effectively crashes the browser since it is impossible to escape from this loop. When this happens, my site is unusable. A better result would be to simple ignore the error which should be logged by Django anyway. This would be the same effect as if the user visited the site with JavaScript disabled and allow the site to continue function in most cases if it is following a degrade gracefully design. Thoughts?

jorgebastida commented 13 years ago

Thank you very much for your comments.

Finally I've removed the alert message, it doesn't help in any way under development or not.

https://github.com/jorgebastida/django-dajax/commit/ef959ad3889d774b86ef89b1903788fefa86ea8f

This changes will be released asap