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

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -