开发者

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

开发者 https://www.devze.com 2022-12-22 20:38 出处:网络
How can we send a large size 开发者_如何转开发of data (>2038 char) from client to Server using ajax?

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.


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.


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);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号