views:

79

answers:

1

Hi all,

I need to do the following:

I have a textbox, which appears in every page of the site, that allows to subscribe to a newsletter. This I've done already and the user is redirected to previous view after subscription.

I'd like to add a javascript alert to the page the user is returned to, something like "Thanks for subscribing". How can this be done?

Thanks in advance.

EDIT: Propably it's not clear from the post tags. I'm using ASP.NET MVC 2 Preview 1

A: 

If you are doing a HTTP redirect, then the page you will render needs to be passed some information so that it knows to include the javascript to open the alert box (adding an optional element to the page might be a nicer way to do this).

That information needs to be stored either in a browser cookie, or in a session store (which is keyed from a browser cookie). You can remove this once you've rendered your message, so that it is only shown the first time you visit that page after the redirect.

fd
Yes, but which is the proposed way to inject the javascript?
I would check for the cookie/session property where you define your page layout/furniture (in your central shared place for common page elements.)
fd