spring - JSP Catching Event from RadionButton -


i looking onchange listener radiobutton in jsp. using example: https://www.tutorialspoint.com/springmvc/springmvc_radiobutton.htm know how catch event of radiobutton on controller ??

there not exist default way in spring. why want this?

you use ajax call send data of selected button rest controller. similar pseudo-code.

    jquery(document).ready(function($) {       $("#your-buttons").change(function(event) {         event.preventdefault();         var data = formname.your-buttons.value;          $.ajax({             type : "post",             contenttype : "application/json",             url : "your/api/url",             data : json.stringify(data),             datatype : 'json',             success : function(data) {                 display(data);             },             error : function(e) {                 display(e);             }         });        });     }); 

then on rest controller have handle other event.

@requestmapping(value = "/your/api/url", method = requestmethod.post) public string whatever(.....) {     // ... } 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -