2012-09-17 67 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,在數據庫中......)。