javascript - Controller do not receive values passed from json.stringify(obj) -


i not understand case:

i have model like:

public class exmdescobertos {     public int id { get; set; }     public int exameid { get; set; }     public int planoid { get; set; }     public int convenioid { get; set; } } 

and create object javascript:

var objdescoberto = new object(); objdescoberto.id = $("#hdndescobertoid").val(); //inputs values... objdescoberto.exameid = $('#hdnexameid').val(); objdescoberto.planoid = $('#hdnplanoid').val(); objdescoberto.convenioid = $('#hdnconvenioid').val(); 

and using json.stringify(obj) transmit values $.post jquery method:

var dados = json.stringify(objdescoberto); 

in point, dados "{"id":"27","exameid":"53","planoid":"32","convenioid":"11"}", example.

and have controller action:

public partialviewresult(exmdescobertos descoberto) { } 

but... parameter in controller not receive values correct! :o in point descoberto id = 0; exameid = 0; planoid = 0; convenioid = 0;

not errors explicit, not works... have idea of have missing? thank all!

don't stringify object, send object is.

$.post("/url", objdescoberto); 

or

var dados = json.stringify({descoberto : objdescoberto}); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -