[英]jquery ajax form.serialize() not working on Server and on local IIS
I have below code in Partial View ,Jquery and Controller . 我在Partial View,Jquery和Controller中有以下代码。
I have used $("form").serialize(); 我用过$(“ form”)。serialize(); method and trying to Post Data to Controller in which I am
方法并尝试将数据发布到我所在的控制器
catching it in Model . 在Model中捕获它。
Code is working fine on Local when I run it with VS2010 but Code is not working on Server for 当我与VS2010一起运行时,代码在Local上运行正常,但在Server for
around 100 Records when I am trying to send it to Controller Screen gets hang on for more than 30 当我尝试将其发送到控制器屏幕时,大约有100条记录被挂起了30多个
min.Also not getting any error on server. 最低,在服务器上也没有任何错误。
Can anyone let me know more about it. 谁能让我知道更多。
1] Jquery Code 1] jQuery代码
$('#btnSave').click(function () {
$("#dvAjax1").css('display', 'block');
var assignCalculationsData = $("form").serialize();
$.ajax(
{ type: "POST",
url: "SaveAssignedCalculations/Pricing",
data: assignCalculationsData,
success: function (data) {
data = $.trim(data);
if (data != "") {
var $response = $(data);
var hdValue = $response.find('#hdSaveStatus').val();
if (hdValue == "2") {//enter mandatory
jAlert('Please enter mandatory data.');
}
else if (hdValue == "1") {
$("#dvBody").html("");
$("#dvBody").html(data);
jAlert('Calculations Saved Successfully');
}
else {//No Data ('0')
jAlert('Please enter mandatory data.');
}
}
else {
jAlert('Please assign calculation(s) before saving.');
}
$("#dvAjax1").css('display', 'none');
}
});
});
})
2] Controller Code 2]控制器代码
public PartialViewResult SaveAssignedCalculations(List<AssignCalculationsDataModel> lstAssignCalculationsSourceDataModel, string fundType, string accountCode, string shareClassID)
{
//Some code
}
Thanks in Advance. 提前致谢。
Thanks, Vaibhav 谢谢,Vaibhav
Try to set timeout
property and see if the server takes more time to process the request. 尝试设置
timeout
属性,并查看服务器是否花费更多时间来处理请求。
$.ajax({
url: "SaveAssignedCalculations/Pricing",
type: "POST",
timeout: 10000,
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.