mardi 24 avril 2018

jQuery.get from Spring RestController

How can should I send the data from Spring controller to the client? Do I need to wrap it as Json or is there an easier way?

(noob in web. So, please bear with me)

@RequestMapping("/abc")
@RestController
public class ListController {

@RequestMapping(value = "/d", method = RequestMethod.GET)
public StringOrJson? getData() {
    return "myData";
}

On the client:

function checkBoxToggled(){
    $(document).get('abc/d', function( data ) {
      alert('Data Loaded2:' + data );
    }); 
}




Aucun commentaire:

Enregistrer un commentaire