Does phpflush have to respond to ajax once?

Source: Internet
Author: User
Can phpflush and ajax respond only once? $. ajax ({type: & nbsp; get, url: & nbsp ;. test. php, beforeSend: & nbsp; function (XMLHttpRequest) {console. log (start & nbsp; Send & nbsp;) ;}, can php flush and ajax respond only once?

$.ajax({
type: "get",
url: "./test.php",
beforeSend: function(XMLHttpRequest){
console.log("start Send ");
},
success: function(data, textStatus){
console.log("Success!");
},
complete: function(XMLHttpRequest, textStatus){
console.log("complete");
},
error: function(){
alert("Error");
}
});

Test. php

ob_start();
echo "First team";
ob_flush();
flush();
sleep(3);
echo "Follower";
ob_end_clean();

Do you want to return "First team" First? if you can, you can make progress bars.
------ Best solution --------------------
Ajax can be processed only when the data is fully accepted.
What you want, unless it is round-robin or long connections with html5
------ Other solutions --------------------
Reference:
Ajax can be processed only when the data is fully accepted.
What you want, unless it is round-robin or long connections with html5

Ah, that's a pity. asynchronous is all different. why ~
I guess it must be an unfortunate security issue or a mechanism restriction that is too difficult to implement ~
The three boxes have to be pulled three times. no matter how big your truck is, it's not environmentally friendly.

------ Other solutions --------------------
No.
However, if the returned results are incomplete, data is processed, and data integrity cannot be guaranteed.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.