Currently, I am utilizing an ajax call to submit a form, but facing difficulties in accessing the parameter as a model attribute.
Ext.Ajax.request({
url: 'url',
headers: { 'Content-Type': 'application/json' },
params : Ext.JSON.encode(form.getValues()), //this is the parameter in jason pattern
success: function(response, options) {
var result = Ext.JSON.decode(response.responseText, true);
if (result.success) {
Ext.Msg.show({
title:'DataBase',
msg: result.message,
buttons: Ext.Msg.OK,
icon: Ext.Msg.INFO
});
I have a question - is it possible for me to access this parameter as a model attribute similar to the code snippet provided below?
@RequestMapping(value="/employee/new", method = RequestMethod.POST )
@ResponseBody public String doAddEmp(@RequestBody String Str){
try{
empServ.setError();
if(empServ.addEmp(Str)){
return "{success:true, message:'Insertion Successfull'}";
}else
return "{success:false, message:\""+empServ.returnError()+"\"}";
}
catch(Exception e){
e.printStackTrace();
return "{success:false, message:'SQL ERROR'}";
}
}
I would greatly appreciate any useful suggestions regarding my query. If the current pattern for the parameter is incorrect, kindly recommend the appropriate pattern.