javascript - Ajax Not Working With C# Controller Action With 2D Array Parameter -
my ajax not hitting controller action. reason?
my controller action
public actionresult save_data(string [][] rosterarray, int pricelist_id, int group_id)
my ajax
$.ajax({ url: '@url.action("save_data", "pricelistmaster")', type: 'post', async: false, contenttype: 'application/json', datatype: "json", data: { "rosterarray": rosterarray, "pricelist_id": "2", "group_id": $("#group_id").val() }, //data: json.stringify({ "item_code": item_code, "ipd_price": ipd_price, "opd_price": opd_price, "ems_price": ems_price }), success: function (data) { debugger if (data.success) { alert('data saved successfully.'); location.reload(); } else { alert(data.error_msg); } } }
if using type: 'post'
in ajax, means need add request type in controller.
try using in controller,
[httppost] public actionresult save_data(string [][] rosterarray, int pricelist_id, int group_id)
use httppost
in method define type of response.
Comments
Post a Comment