2

I need to pass huge amount of data to server without page loading. I have this code:

var GlType = "<%=GlType %>";
var pageUrl = "SelectAccount.aspx?callback=true&AccountList=" +accountList +"&AnalysisDate="+analysisDate+"&GlType="+GlType;
if (window.XMLHttpRequest)
 {
      var xmlRequest = new XMLHttpRequest();
 }
else
 {
      var xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
 }
xmlRequest.open("POST", pageUrl, true);
xmlRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
xmlRequest.send(null);

I am have passed using query string its exceeded the maximum Length of query string. Help me on this..

2 Answers 2

1

Since you're already using the POST method, you can pass data in the body.

xmlRequest.send("Field1=abc&Field2=def");

You can retrieve the data on the server, e.g. in ASP.NET:

if (Page.Request.Form["Field1"] == "abc") ...

For GET method you can only use the query string for transferring data.

Sign up to request clarification or add additional context in comments.

1 Comment

How to retrive data in server please paste some code in c sharp.
0

You're sending the request via post, but putting everything in the query string!

Instead, you should send the data as the body of the request (passed to the send method).

2 Comments

thanks for u'r reply How to get a data in server side post some code sample in c sharp
@Koen has posted a sample of how to retrieve the data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.