this is my javascript code
<script type="text/javascript">
function callMe() {
var districtId = $("#district").val();
alert(districtId);
$.ajax({
type: "POST",
url: "addBranch",
data: "districtId=" + districtId,
success: function(response) {
}
});
}
</script>
this is my controller code
@RequestMapping(value = "/addBranch", method = RequestMethod.POST)
public @ResponseBody
List getForm1(@ModelAttribute Branch branch, Model model,@RequestParam("districtId")
int districtId) {
try {
districtVillageList = villageService.getDistrictVillageList(districtId);
} catch (Exception er) {
log.error("error in addLoanType=" + er);
}
return districtVillageList;
}
I am getting the list in the controller, but as i am new to ajax,i dont know how to retrieve the list in the ajax and use the retrieved values in jsp...Please can any one helo me??