asp.net - 当 jquery ajax 调用的 aspx web 方法具有超过 8 个参数时无法访问
问题描述
我的 aspx web 方法有 10 个参数。当 jquery ajax 调用的 aspx web 方法具有超过 8 个参数时,我无法访问。8个参数方法可以无错误地访问。唯一的问题是调用这 10 个参数的方法时。我收到 500 个内部错误。
我的阿贾克斯电话:
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",
我的 aspx 网络方法
[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)
解决方案
像这样改变数组。
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",
推荐阅读
- windows - 我可以比较硬盘文件夹和git项目代码吗
- javascript - FabricJS 对象多重过滤器管理,添加还是替换?
- sql - 如何在 PL/SQL 的存储过程中将列名作为参数传递?
- javascript - 如何在关闭模式时将比例缩放到 1.0 并修复
- reactjs - React setState 函数 - 图片上传器
- javascript - 使用 Chart.js 和 chartjs-plugin-annotation 绘制刻度线左/右的垂直注释线
- c# - 如何使用 C# 获得终端的功能?
- javascript - 使用 javascript 在 for 循环中延迟基于承诺的多文件上传处理到使用 ajax 的 esp32
- elasticsearch - 如何验证策略是否正确应用于 ES 中的索引?
- docker - --attach STDIN 和 --interactive 之间的确切区别是什么?