Hi,

I am facing some problem when i'm using jquery for implemening autocomplete box for my spring app.

Problem: Not getting response from server to the client.
Details :

#1. send request to the server using following code snippet.



$(document).ready( function(){
var AUTOCOMPLETE_URL = "admin.gpp?_m=getContractorsForTypeAhead";


$( "#addContractUser" ).autocomplete({
source: function( request, response ) {
$.ajax({
url: AUTOCOMPLETE_URL,
dataType: "json",
type:"POST",
data: {
featureClass: "P",
style: "full",
maxRows: 12,
addContractUser: request.term
},
success: function( data ) {
alert("data is" + data);
response( $.map( data.geonames, function( item ) {
return {
label: item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName,
value: item.name
}
}));
}
});
},
minLength: 6,
select: function( event, ui ) {
log( ui.item ?
"Selected: " + ui.item.value + " aka " + ui.item.id :
"Nothing selected, input was " + this.value );
}
});

});

******************************************
#2. Trying to return matched search list from controller to the client.

Here below is the code:

public ModelAndView getContractorsForTypeAhead(HttpServletRequest request,HttpServletResponse response) throws ParseException {
List contractorList = null;
StringBuilder json = new StringBuilder();
String searchString = request.getParameter("addContractUser");
contractorList = specialUserDetailsService.getContractorsForTypeAhe ad(searchString);

System.out.println("contractorList ="+contractorList);
if(contractorList!=null)
{
System.out.println("contractorList size="+contractorList.size());
}

Map returnMap = new HashMap();

returnMap.put("contractorList", contractorList);
json.append("{\"contractorList\":[");
for(int i=0;i<contractorList.size();i++){
json.append("\""+contractorList.get(i)+"\"");
if(i < contractorList.size()){
json.append(",");
}
}
json.append("]}");
System.out.println("JSON is :"+json);

return null;
}

**********************************
#3. I'm not getting response data from the server.

Please help me out !!!!!!!

Thanks in advance...