javascript - 400 error - The request sent by the client was syntactically incorrect -


i'm trying send ajax request spring controller, request doesn't reach controller. instead 400 error following description: request sent client syntactically incorrect. javascript function sends request looks this:

 function rzdeleteevent() { saveuncheckedeventgroups(); $.ajax({   url: '${param.removeeventurl}&starttime=' + activestarttime + "&endtime=" + activeendtime,   type: 'post',   datatype: 'json',   data: json.stringify(activeevent),   contenttype: 'application/json',   success: function(result) {     hideuncheckedeventgroups(result);     ical.hidepreview();     ical.render(result);     sortgroupfilters();   },   error: function(jqxhr, textstatus, errorthrown) {     ajaxerrormsg();   } }); } 

the controller is:

@controller @requestmapping("/resourcereservationcalendar/") @sessionattributes(selected_resources_list) public class resourcereservationcalendarcontroller extends calendarbasecontroller {  private static final string calendar_view = "resourcereservationcalendar";  private static final string select_view = "resourceselect";  private static final int zero_hour = 0;  private static final int twenty_four_hour = 24;  @autowired private resourcerepository resourcerepository;  @autowired private userrepository userrepository;  @autowired private userresourceservice userresourceservice;  @autowired private controlvaluerepository controlvaluerepository;  @modelattribute(value = "reservationtypes") public list<code> getreservationtypes() {     return cacheservice.getvalidcodesofcodegroup(resource_reservation_type); }  @requestmapping(method = get) public string getview(modelmap modelmap) {     controlvalue calendargridstarttimecontrolvalue = controlvaluerepository.findbycode(calendar_grid_start_time);     controlvalue calendargridendtimecontrolvalue = controlvaluerepository.findbycode(calendar_grid_end_time);     int calendargridstarttime = calendargridstarttimecontrolvalue.getlongasintvalue();     int calendargridendtime = calendargridendtimecontrolvalue.getlongasintvalue();     if (calendargridstarttime < zero_hour || calendargridstarttime > twenty_four_hour) {         calendargridstarttime = allday_start_hour;     }     if (calendargridendtime < zero_hour || calendargridendtime > twenty_four_hour         || calendargridendtime <= calendargridstarttime) {         calendargridendtime = allnight_start_hour;     }     modelmap.addattribute("calendargridstarttime", calendargridstarttime);     modelmap.addattribute("calendargridendtime", calendargridendtime);     modelmap.addattribute(getresourceselectiondto());     modelmap.addattribute(new serialreservationcommand());     addputmethodto(modelmap);     return calendar_view; }  @suppresswarnings("unchecked") private resourceselectiondto getresourceselectiondto() {     return new resourceselectiondto(userrepository.findbyid(getuserid()).getresources()); }  @requestmapping(method = get, params = "content=json") @responsebody public list<calendargroupjson> getreservations(@modelattribute interval interval) {     return getgroups(interval); }  @suppresswarnings("unchecked") private list<calendargroupjson> getgroups(interval interval) {     list<calendargroupjson> calendargroupjsons = new arraylist<calendargroupjson>();     list<resource> resources = resourcerepository.findresourcedtos(getuserid(), interval);     (resource resource : resources) {         calendargroupjsons.add(jsonconverterservice.converttojsongroup(resource, interval));     }     return calendargroupjsons; }  @requestmapping(method = get, value = "select") public string getselectview(modelmap modelmap) {     modelmap.addattribute(getresourceselectiondto());     addputmethodto(modelmap);     return select_view; }  @requestmapping(method = put) public string updateresourceselections(@valid resourceselectiondto resourceselectiondto, modelmap modelmap) {     userresourceservice.updateresourcesforuser(resourceselectiondto);     addputmethodto(modelmap);     return select_view; }  @requestmapping(method = post, params = "content=json") @responsebody public list<calendargroupjson> addnewresourcereservation(@requestbody updatecalendareventjson eventjson,                                                          @modelattribute interval interval,                                                          @modelattribute education defaulteducation) {     system.err.println("addnewresourcereservation");     eventvalidator.validate(eventjson);     resourcereservationservice.createreservations(eventjson, defaulteducation);     return getgroups(interval); }  @requestmapping(method = post, params = "content=json", value = "update") @responsebody public list<calendargroupjson> updateresourcereservation(@modelattribute interval interval, modelmap modelmap,                                                          @requestbody updatecalendareventjson eventjson,                                                          @modelattribute education defaulteducation) {     system.err.println("updateresourcereservation");     eventvalidator.validate(eventjson);     resourcereservationservice.updateresourcereservation(eventjson, defaulteducation);     return getgroups(interval); }  @requestmapping(method = post, params = "content=json", value = "remove") @responsebody public list<calendargroupjson> removeresourcereservation(@requestbody updatecalendareventjson eventjson,                                                          @modelattribute interval interval) {     system.err.println("remove");     eventjson.setid("13515597");     resourcereservationservice.removeresourcereservationwithoutlearningevent(eventjson);     return getgroups(interval); } } 

only remove , update resource reservation post requests have problem. other post request (add new resource reservation) works correctly. looked similar problem, on so, none of proposed solutions helped in case.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -