2012-09-17 41 views
0

$.ajax开始做URL长度或参数长度有限制吗?jquery 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

为什么不张贴呢? –

回答

0

如果通过Ajax被查询不要紧,对URL的长度一般限制。有关说明,请参阅this question

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