Can a javascript function be called from django HttpResponseredirect or some other django function
5 Answers
If you're talking about in-browser js, no, django cannot call a javascript function. You've got django running on your server, and js running in the user's browser, and never the two shall mingle. Imagine if any old django site out there could reach into your browser at will and start doing things you didn't ask for!
What you can do is setup some sort of communication between the two, aka AJAX. Have the javascript side periodically poll the django server for information, at which point django can tell the javascript what to do (do this function, run that process). Or figure out how to do comet.
OTOH, If you're talking about server-side js, sure, why not? It'd be the same as calling a perl function, or a ruby function (feed the interpreter the correct instructions to import/define/call that function).
Comments
You can also use Dajax, it's an easy way to use AJAX libraries on django: Dajax