I make an ajax call to populate dynamically a select tag on user's option.
function updateSelect(){
var ddlTool = $('#selectTool');
var ddlAction = $('#selectAction');
ddlTool.on('change',function(){
//append the placeholder
ddlAction.html('<option value="NONE">Select action</option>')
var option = ddlTool.val();
$.ajax({
url: "/eMuse/loadActions",
data : {id:option},
success : function (response){
debugger;
for(var i = 0; i < response.length; i++){
ddlAction.append('option value="' + response[i].value + '">'+
response[i].text + '</option>');
}
}
});
});
}
In Controller i have this method:
@RequestMapping(value = "/loadActions", method = RequestMethod.GET, produces ="application/json")
public @ResponseBody List<DropDownListItem> loadActionsGET(@RequestParam("id") long id) {
// load actions by selected tool
List<ActionViewModel> actions = StudentModelMapper
.mapListActionDTOToListActionVM(actionService
.getActionsByIdTool(id));
List<DropDownListItem> items = new ArrayList<DropDownListItem>();
for (ActionViewModel a : actions) {
items.add(new DropDownListItem(String.valueOf(a.getIdAction()), a
.getName()));
}
return items;
}
If i run :
http://localhost:8080/eMuse/loadActions?id=1
i also get the NOT FOUND error
In my web.xml file i have map the servlet like this:
<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
If i replace the url-pattern *.html
with /*
then I am able to run the link above, but everything else falls apart.
Can anybody help me?