且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将大数据发送到服务器

更新时间:2023-01-17 10:38:10

是否存在"URI太长"的解决方法?

Are there workarounds of "URI too long" thing?

使用POST HTTP动词代替GET:

Use a POST HTTP verb instead of GET:

$.ajax({
    url: '/foo',
    type: 'POST',
    data: { value: someVariableThatCouldBeHuge },
    success: function(result) {
        // TODO: process the results
    }
});

或等价物:

$.post('/foo', { value: someVariableThatCouldBeHuge }, function(result) {
    // TODO: process the results
});