javascript - Ajax query string not being posted to ASP.NET controller -
i have ajax function:
updateficonfig: function ($appform) { var valid = $appform.valid(); //if not valid validate plugin take care of errors if (valid) { $appform.serialize(); $.ajax({ url: '/identificonfig/defaultconfiguration/updateficonfig', data: $appform, datatype: 'application/json', cache: false, type: 'post', success: function (data) { if (data.error) { cc.jqutils.opendialog(data.errordescription, 'error', 'ok', null, null, null); } else { window.location.href = '/identificonfig/defaultconfiguration'; } } }); } },
which serializes data sent view query string. know data serialized correctly because have viewed string console.log($appform)
, , it's correct.
however, controller never receives query string. have removed lot of code, controller function looks like:
[httppost] public actionresult updateficonfig(string query) { namevaluecollection nvc = httputility.parsequerystring(query); system.diagnostics.debug.writeline(nvc); }
i receive null pointer on line tries parse query string, , don't know why. help?
i have same thing ajax in project different don't use datatype contenttype: "application/json; charset=utf-8"
data: "{'query' : '" + $appform + "'}"
Comments
Post a Comment