Firefox正在以不同于Chromium的方式处理ajax?

I have three scripts: -

//progress.php
<?php
    session_start();
    echo $_SESSION["progress"];
?>

//long_progress.php
<?php
    for($i=1;$i<=10;$i++){
        session_start();
        $_SESSION["progress"]=$i;
        session_write_close();
        sleep(1);
    }
?>

<!--index.php-->
<html>
<head>
    <script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
</head>
    <script type="text/javascript">
    //Start the long running process
    $.ajax({
        url: 'long_progress.php',
        success: function(data) {
        }
    });
    //Start receiving progress
    function getProgress(){
        $.ajax({
            url: 'progress.php',
            success: function(data) {
                console.log(data)
                $("#progress").html(data);
                if(data<10){
                    getProgress();
                }
            }
        });
    }
    getProgress();
</script>
<div id="progress"></div>
</html>

So when i load index.php in chromium, I can see the the content of progress.php changing in real time. The requests work just like they should. In Firefox however nothing happens. Opening the consoles of the respective browsers yeild this: - In chromium, the numbers are printed, 1-10, as they should.

In firefox, however, just multiple "". My query is, why the discrepency, when the code has no issues? What is this inexplicable issue? And how can it be resolved.

Also, please do not mark this as duplicate, since this is similar to this and cannot be deleted since it already has answers. Also this question forms the basis for answering that question.

Reference - php/ajax to get contents of long running code in real-time

You should move the

session_start();

out of the loop in your long_process.php. I don't see why you repeatly open and close the session. You should just start the session once at the beginning of your script, and close it at the end.

Give it a try.

I tried your script with FF and it works as intended but I see a problem ... you are making requests as fast as possible which may be causing unexpected results and will overload your server as the number of users accessing the script increases.

I would limit this with setTimeout

            success: function(data) {
                console.log(data)
                $("#progress").html(data);
                if(data<10){
                    setTimeout(getProgress, 1000);
                }
            }