javascript - JSON object passed to Controller is NULL -
i understand question has been posted thousand times, have tried every solution no avail.
i have json object:
{    "manufacture":"hp",   "model":"testmodel",   "serialnumber":"testserial",   "description":"test description",   "checkin":true,   "stand":false,   "tilt":true,   "pivot":false,   "heightadjust":true,   "size":27,   "porttypes":"2 vga",   "resolution":"1080p" } i pass json object controller just
function submitmonitor(monitor monitor)   return false end function the ajax call pass controller follows:
jquery.ajaxsettings.traditional = true; $.ajax({     url: '@url.action("submitmonitor", "home")',     type: 'get',     contenttype: 'application/json',     //contenttype: "application/json; charset=utf-8",     //datatype: 'json',     //processdata: true,     data: json.stringify(data) }); i have tried passing:
data:data i have tried without ajaxsettings.traditional line. have tried commented blocks on or off, still no luck.
here class should passing to.
public class monitor : inherits hardwaredata    public stand boolean    public tilt boolean    public pivot boolean    public heightadjust boolean    public size integer    public porttypes string    public resolution string end class here class monitor inherits:
public class hardwaredata    public key integer    public manufacture string    public model string    public serialnumber string    public createdby string    public createdtimestamp date    public description string    public checkin boolean end class whenever controller gets called though, looking @ monitor variable in debugger, see values set nothing.
any idea causing this?
based upon data showing in json. need set monitor
$.ajax({     url: '@url.action("submitmonitor", "home")',     type: 'get',     contenttype: 'application/json',     data: {monitor:data} }); 
Comments
Post a Comment