从$.ajax
开始时,网址长度或参数长度是否有限制?
下面是我的代码,其中var extract
可以是5000个字符的长度,其中两个可以是128个字符长度。
$.ajax({
url: "addObligationDraft?account.id="+aId+"&extract="+extract+"&groupForId="+groupForId+"&groupFor="+groupFor+"&TAndD="+TAndD+"&fg="+fg+
"&frequency="+frequency+"&subType="+subType+"&startDate="+startDate+"&completionDate="+completionDate+"&ownerUserId="+ownerUserId+
"&ownerManagerUserIdValue="+ownerManagerUserIdValue+"&financial="+financial+"&trigger="+trigger+"&actionType="+actionType+"&financialPenalty="+financialPenalty+
"&approvalRequiredMessage="+approvalRequiredMessage+"&transitionMilestoneMessage="+transitionMilestoneMessage+"&responsibilityListId="+responsibilityListId+
"&contractName="+contractName+"&phaseListId="+phaseListId+"&referenceSectionMessage="+referenceSectionMessage+"&obId="+obId+
"&otCrossReference="+otCrossReference+"&otTransition="+otTransition+"&otCustOO="+otCustOO+"&otComments="+otComments,
dataType: "stream",
beforeSend: function(){
showBusy();
},
complete: function(xmlHttp){
hideBusy();
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
hideBusy();
showDialogMessage('Obligation not Saved. Please re-try.');
},
cache: false,
success: function(data) {
if(data.indexOf('Error') == -1) {
$("#obDraft").empty();
$("#obDraft").append(data);
document.getElementById("noObInDraft").style.display = "none";
resetPage();
var chk = data.split("javascript:showDraftOb");
chksize = data;
if(chk.length == 2)
document.getElementById("addObligationAjax").style.display = "block";
showDialogMessage('Obligation Added Successfully');
}
else
showDialogMessage('Obligation not Saved. Please re-try.');
}
});
答案 0 :(得分:1)
如果通过Ajax查询无关紧要,则URL长度存在一般限制。有关说明,请参阅this question。
问问自己是否真的需要这么长的网址,或者您是否可以通过其他方式存储某些信息(例如,在数据库中使用Cookie ...)。