Jquery code to call my spring controller:
$.postJSON("/DialogController", myJSON, function(data) {
previewDialog.html(data);
previewDialog.dialog('open');
});
And then my controller code, which causes a http 500 error, I have debugged it and find it all works fine until the return string(view name), what am I doing wrong ?
@RequestMapping(value = "/DialogController", method = RequestMethod.POST)
public String dialogController(Model model, @RequestBody MyClass myClass) {
myClass.setTitle("SUCCESS");
model.addAttribute("myClass", myClass);
return "dialogContent";
}
Using jquery load with get request on the controller works to an extent - in that it returns the view and loads into dialog; but the attribute is not added to model and I can not post json data to the controller.
Any tips ?