1

Is there a limit on URL-Length or on Parameter-Length while doing from $.ajax?

below is my code, in which var extract could be length of 5000 characters, and two of them could be 128 chars length.

    $.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.');
        }
    });
j0nes
  • 8,041
  • 3
  • 37
  • 40
ArunK
  • 67
  • 2
  • 10

1 Answers1

1

It does not matter if queried via Ajax or not, there is a general limitation on URL length. See this question for an explanation.

Ask yourself if you really need such a long URL or if you can store some information in other ways (e.g. cookies, in a DB...).

Community
  • 1
  • 1
j0nes
  • 8,041
  • 3
  • 37
  • 40