pauloh
pauloh

Reputation: 1002

Call controller method inside javascript function

Opah!

Is there any way I can call a method in the controller through a javascript code? I am wanting to destroy a Session to leave a specific page.

Thanks!

Upvotes: 1

Views: 11039

Answers (1)

moi_meme
moi_meme

Reputation: 9318

the simplest way to do this IMO is with javascript, calling

$.ajax(url: 'controller/action',success: function(data) { //do whatever with your result... }) 

you can also use $.get(), $.post()...

see jQuery - Ajax API for more.

Upvotes: 7

Related Questions