views:

308

answers:

1

How do you call a server side code and javascript in MVC? We are having a close button on every page. on click of close button there should be a call to controller action and the browser should close. Also if the user clicks the browser close the same controller action should be called before closing. Have anyone done similar stuff before

A: 

You need to implement an controller for that action. Javascript [ajax] call is a simple http-request, and you need to answer response as a json or xml. Google for an json serializer for java, there are many exists.

I can recommend you use jquery and google-json for this.

splix