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 wanti开发者_如何学JAVAng to destroy a Session to leave a specific page.
Thanks!
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.
精彩评论