1

执行 from 时对 URL-Length 或 Parameter-Length 是否有限制$.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.');
        }
    });
4

1 回答 1

1

是否通过 Ajax 查询无关紧要,对 URL 长度有一般限制。请参阅此问题以获取解释。

问问自己,您是否真的需要这么长的 URL,或者您是否可以以其他方式存储一些信息(例如 cookie、在数据库中......)。

于 2012-09-17T12:03:50.903 回答