I'm sending ajax request to spring controller and getting array list. How to get ArrayList to ajax result and print it in tabular formate.When i'm printing alert(data) in ajax it is showing all html page can any one suggest me how to solve this, `
<div>
<input type="text" id="searchtext">
<input type="button" id="verifybtn" value="search" ">
</div>
<table class="table">
<tr>
<th>Application ID</th>
<th>Application Type</th>
<th>Customer ID</th>
<th>Remarks<th>
</tr>
<tr>
<c:forEach var="list4" items="">
</c:forEach>
</tr>
</table>
this is my ajax`
$("#verifybtn").click(function(){
var s = $("#searchtext").val();
//alert(s);
$.ajax({
url:"${pageContext.request.contextPath}/officer/search.html",
type:"GET",
data:{searchtext:s},
dataType:"html",
success:function(data){
alert("data is"+data),
$("result").html(data);
}
})
})
`controller
@RequestMapping(value="/search")
public String search(@RequestParam("searchtext") String strtosearch,HttpSession hs,Model m)
{
ArrayList<Application> all=(ArrayList<Application>)service.searchbyApplicationID(strtosearch);
return "Home";
}