1

I need to send a pretty large amount of data from a web application to a ASHX handler. The handler will then send the data to a web service for a response. ( The reason the handler is dealing with the web service is because the web app is written in classic ASP and with the handler I am using .NET so I can just consume the service. )

What I need to do is send data to the handler with Javascript. Right now I am using an XMLHttpRequest and opening the correct URL. But I do not want to send a large amount of data through the query string. So my question is, how would I send a large amount of data to the handler? If there is another way besides using XMLHttpRequest, I am all ears.

Thanks

Aarron H
  • 185
  • 1
  • 15
  • What is the format of the data you wanna post? I mean is it a large file? Your form has a lot data to post? what is it exactly. It's important. – Rikki Nov 12 '12 at 19:12
  • It will include many different objects. Including two address objects ( sending and receiving ), Package objects ( height, width, depth, weight, etc ), Carrier selection. – Aarron H Nov 12 '12 at 19:19

1 Answers1

3

You can use a POST request instead of a GET request

Generally data sent by get is appended to Query string ..

Data sent by post is not appended to query string

var url = "get_data.ashx";
var params = "lorem=ipsum&name=binny";

http.open("POST", url, true);

http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.send(params);
Sushanth --
  • 55,259
  • 9
  • 66
  • 105