asp.net mvc - .ajax get keep data keep coming null in controller -
i trying utilize next function data.
function savedata() { var value = $('#tblradio').find('input[type="radio"]:checked').val(); $.ajax({ type: "post", url: '/home/isemployeevoted', success: function (result) { alert(result); // shows whole dom if (parseint(result) > 0) { $('div.dvvotewrapper').removeattr('style'); $('div.popuparea').removeattr('style'); } else { window.location = '/home/employeevote?regoinid='+ value; } }, error: function () { alert("sorry, requested property not found."); } }); }
the controller function:
public actionresult employeevote(string regionid) { }
regionid maintain coming null me though value variable have value in javascript. ideas ??
change
data: 'regionid=' + value,
to
data: {regionid: value},
you need pass info object literal. alternative (which dont recommend), closer idea:
url: '/home/isemployeevoted?regoinid=' + value,
but if want work need remove type: 'post'
(since default type).
asp.net-mvc jquery
No comments:
Post a Comment