Support jQuery's Transfer-Encoding:chunked
P粉566048790
P粉566048790 2023-10-25 23:44:37
0
1
579

I am a web developer. Using header() in my script sets "Transfer-Encoding:chunked". and flush() to the web page. It will be printed in a time-shared manner in the web page. Works fine. However, when I request this.it using jQuery.ajax(), it is always outputted together (chunking is useless).

how to solve this problem? Using chunked encoding in jQuery ajax?

P粉566048790
P粉566048790

reply all (1)
P粉366946380

You cannot use jquery.ajax to read chunked http responses continuously. jquery ajax only calls the success callback function when the connection is terminated. you should useThisjquery plugin.

If you use php, you can use the following code:

     

On the server side:

Stream.php

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!