I am trying to pass data into my server using an ajax call. There are 2 items that are being passed; a set of floats that are coordinates and a set of dates that are strings. On the backend the dates are XMLGregorianCalendar objects. Do I need to convert and then pass them and if I do how would I do that? Here is my javascript function that makes the ajax call:
`getResourceNetworkByAoiTime: function(aoi,dateRange){
var AreaOfInterest = {eastLon:aoi[0],westLon: aoi[1],southLat:aoi[2],northLat:aoi[3] };
var LocalDateTimeRange ={start:dateRange[0],end:dateRange[1]};
//var JData = {{eastLon:aoi[0],westLon: aoi[1],southLat:aoi[2],northLat:aoi[3]},{start:dateRange[0],end:dateRange[1]}};
var DTO ={};
DTO.AreaOfInterest = AreaOfInterest;
DTO.LocalDateTimeRange =LocalDateTimeRange ;
var self = this;
$.ajax({
cache: false,
url: cdpeConfig.edcssUrl+"getAllResourceNetworksByAoiAndTime2/",
type: 'GET',
contentType:"application/json; charset=utf-8",
dataType: "json",
data:JSON.stringify(DTO),
// data:jsonarg1+jsonarg2,
success: function(data) {
Alertify.dialog.alert('Successful AJAX resource network');
}
}).fail(function(jqXHR, textStatus, errorThrown) {
sandbox.emit('error', { action: 'initialError', jqXHR: jqXHR });
});
}`
Here is the method that the javascript is calling:
public List <ResourceNetwork> getAllResourceNetworksByAoiAndTime2(GetAllResourceNetworksByAoiAndTime aoi_dateRange){
ResourceNetworkServiceService resourcenetwork_service_service = new ResourceNetworkServiceService();
ResourceNetworkService resource_service resourcenetwork_service_service.getResourceNetworkServicePort();
List<ResourceNetwork> resource_networks = null;
AreaOfInterest aoi = new AreaOfInterest();
LocalDateTimeRange date_range = new LocalDateTimeRange();
aoi.setEastLon(aoi_dateRange.getArg0().getEastLon());
aoi.setWestLon(aoi_dateRange.getArg0().getWestLon());
aoi.setSouthLat(aoi_dateRange.getArg0().getSouthLat());
aoi.setNorthLat(aoi_dateRange.getArg0().getNorthLat());
date_range.setStart(aoi_dateRange.getArg1().getStart());
date_range.setEnd(aoi_dateRange.getArg1().getEnd());
resource_networks = resource_service.getAllResourceNetworksByAoiAndTime(aoi, date_range);
return resource_networks;
}
Thanks for all help!
Aucun commentaire:
Enregistrer un commentaire