需要通过php函数打包gzencode来处理数据。 Gzencode很重要,因为数据量超过30MB!
PHP
header('Pragma: no-cache');
header('Cache-Control: private, no-cache');
header('Content-Disposition: inline; filename="files.json"');
header('Content-type: application/json; charset=utf-8');
header('Content-Encoding: gzip');
header('Vary: Accept-Encoding');
echo gzencode ( json_encode ( $arr ) );
的Javascript
jQuery.ajax({
url: path,
type: 'POST',
data: data,
headers: {"Content-Encoding": "gzip"},
dataType: 'json',
success: [jQuery.ajaxCallback, function()
{
// manipulation with json object data
}]
});