jquery - get json data in controller action in asp.net mvc -


i have asp.net mvc application. want configure object in jquery , want pass the action of controller . in script using configure data ajax call:

var arr=new array();  arr.push(0)=1; arr.push(1)=2; arr.push(2)=3;  var  peform = {                  empid: eid,                  depatrmentid:deptid,                  empaddress:straddress,                  empbirthdate:bdate,                  empaccountsid:arr               };   

i able values in param here but. when trying this:

if(peform!=null)             {                   var json = $.tojson(peform);                   $.ajax({                  url: '/load/savedata',                  type: 'post',                  datatype: 'json',                  data: json,                  contenttype: 'application/json; charset=utf-8',                  success: function (data) {                  }         });    } 

it not calls action in controller. think here :

 var json = $.tojson(peform); 

is not working expect. need add js file reference ? or mistake in syntax? or please suggest me other remedy.

try following instead:

var json = json.stringify(peform); 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -