asp.netwebmethodsjquery-ajaxq

not able to access when aspx web method having more than 8 parameters from jquery ajax call


My aspx web method having 10 parameters. I am not able to access when aspx web method having more than 8 parameters from jquery ajax call. The 8 parameters methods are able to access without any error. Only issue is when call this 10 parameters method.I am getting 500 internal error.

My Ajax call:

var updatedata = '{slNo: "' + GsSlNo + '", oldCategoryName: "' + GsItemCategory + '", newCategoryName:"' + $('#ddlCategoryName').val() + '", itemName: "' +
                   $('#txtItemName').val() + '", modelNo: "' + $('#txtModelNo').val() + '", stockQty: "' + $('#txtStockQty').val() + '", description: "' +
                   $('#txtDescription').val() + '", imageString: "' + imgData + '", fileName: "' + sFileName + ', oldImagePath:"' + GsItemImagePath + '"}';

            $.ajax({
                type: "POST",
                url: "sitesettings.aspx/UpdateItemMaster",
                data: updatedata,
                async: false,
                contentType: "application/json; charset=utf-8",
                dataType: "json",

My aspx webmthod

[System.Web.Services.WebMethod]
    public static long UpdateItemMaster(string slNo, string oldCategoryName, string newCategoryName, string itemName, string modelNo, string stockQty, string description, 
                                        string imageString, string fileName, string oldImagePath)

Solution

  • Change array like this.

    var params = new Object();
    params.slNo = GsSlNo;
    params.oldCategoryName = GsItemCategory;
    .
    .
    .
    params.stockQty= $('#txtStockQty').val();
    
     $.ajax({
                    type: "POST",
                    url: "sitesettings.aspx/UpdateItemMaster",
                    data: data:JSON.stringify(params),
                    async: false,
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",