Question

How can we send a large size of data (>2038 char) from client to Server using ajax?

I like to send an array of key-pair values of size more than 10KB. I am currently using cookies, is there any other prefered way by which we can send it through an Ajax Call.

Was it helpful?

Solution

The 2038 or so max is for data sent as Get parameters. The solution is to use the Post call to your Ajax library. See your library's docs for info.

Otherwise, max is set by http server or framework. 10KB should not be a problem at all.

See Max length of send() data param on XMLHttpRequest Post for more info.

OTHER TIPS

You can try this.

var formData = new FormData(); 
formData.append(fileType + '-filename', fileName); 
formData.append(fileType + '-blob', blob); 
var request = new XMLHttpRequest(); 
request.open('POST', '/Admin/Videos/PostRecordedAudioVideo'); 
request.send(formData);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top