On Jul 14, 2009, at 12:30 PM, luca72 wrote:

>
> Hello
> I have a question in my view fiole i have this
>
> def myfunct()
>     do this...........................
> now i need only to return a js alert message on the same page
> is it possible?

We need more information. Are you calling myfunct() via an AJAX call?  
I don't see a request in the argument list, but is that because you  
left it out, or is this not a "view" function (receives request and  
returns a response)?

Your function executes server-side, and JavaScript (obviously)  
executes client-side. Python can't do the alert box, but it can:

1. Render a template containing the JavaScript.
2. Pass the JavaScript text into a templatt, via the Context.
3. Return a JSON value via AJAX to the template's JavaScript (you have  
to bind the handler in the JavaScript, preferably using jQuery for  
ease-of-use) that passes the message to be used for the alert.

I hope this helps. If not, please send more relevant detail. Pretend  
you're explaining the problem to someone who has no idea what you're  
talking about, because we don't.

Shawn

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to