I have JSONArray value in struts2 action class and need to pass to Jquery Ajax url to display into jquery datatable.
Action class:
public String JSONOarr(){
JSONArray ja = new JSONArray();
try {
Iterator it = findList.iterator();
while(it.hasNext()){
SearchResult part = (SearchResult) it.next();
ja.add(part.getlist1());
ja.add(part.getlist2());
}
} catch (Exception e) {
log.error(e);
}
return SUCCESS;
}
Struts2 codebehind annotation in class level:
@Result(name="success",type=JSONResult.class,value=""
Jquery for get the JSONArray:
jQuery.ajax({
url : '<s:url action="part" method="list" />',
dataType : 'json',
success : function(data){
How to get this JSONArray value ?