Ajax send json data to Controller and get result back

#HTML========================== <input type=”text” placeholder=”” id=”search”> #JS========================== function search(){ var text = document.getElementById(“search”).value; if(text != ”){ $.ajax({ type: “GET”, url:”getList”, data: {“text”:text}, datatype: “json”, success: function(data){ console.log(data); } }) } }; $(“#search”).on(‘input’,search); #Controller========================== @RequestMapping(value = “/getList”, method = RequestMethod.GET) @ResponseBody public…