How to keep google-chrome from buffering












0















I have a situation where I am calling a js function when a button is clicked in a php page, a hidden dialog is displayed and some data is painted in the dialog prior to issuing a series of synchronous ajax calls which generate SQL statements server-side. This process may be repeated in a loop which is the reason for the synchronous ajax as the loop would need to be interrupted should the ajax call return an error of some kind.



My problem is that Chrome will not display the data prior to the ajax call whereas firefox will. I've tried setting the contentType method of the jqXHR Object to "application/octet-stream" but no luck.



Here's the ajax code:



 $.ajax({
async : false,
url : "url",
method : "GET", // redudntant, GET is the default
dataType : "text",
beforeSend : function(xhr) {
xhr.overrideMimeType("application/octet-stream;");
},
success : function(data) {
// do stuff with data
}
}).fail(function(xhr, status, error) {
// do stuff with error
});









share|improve this question

























  • This process may be repeated in a loop which is the reason for the synchronous ajax as the loop would need to be interrupted should the ajax call return an error of some kind. Huh? Asynchronous calls can be aborted and can have error callbacks.

    – Scott Marcus
    Nov 21 '18 at 20:00











  • Right, but as I indicate the ajax call must return its data before the loop is repeated. Not only that but the user has no idea what's happening because chrome is not allowing anything to display. The server-side process can take some time to complete so I need to show something otherwise he'll think it's frozen. Firefox doesn't do that. Anything I add to a div's innerHTML appears instantly.

    – Sam
    Nov 21 '18 at 22:18











  • So, don't use a loop at all. Use a regular asynchronous AJAX call and separate the loop code into its own function. Then, in the success callback, call the function that used to be the loop body. Then, the browser won't become unresponsive and you won't perform the next task until the previous one is done.

    – Scott Marcus
    Nov 22 '18 at 0:02











  • Good advice but it doesn't answer the main point of the question: why is chrome behaving differently from firefox? Is it due to buffering (I read somewhere that chrome buffers 1K before displaying) and if so how can that be overcome? I'd like an answer to that before I restructure my logic.

    – Sam
    Nov 22 '18 at 12:05
















0















I have a situation where I am calling a js function when a button is clicked in a php page, a hidden dialog is displayed and some data is painted in the dialog prior to issuing a series of synchronous ajax calls which generate SQL statements server-side. This process may be repeated in a loop which is the reason for the synchronous ajax as the loop would need to be interrupted should the ajax call return an error of some kind.



My problem is that Chrome will not display the data prior to the ajax call whereas firefox will. I've tried setting the contentType method of the jqXHR Object to "application/octet-stream" but no luck.



Here's the ajax code:



 $.ajax({
async : false,
url : "url",
method : "GET", // redudntant, GET is the default
dataType : "text",
beforeSend : function(xhr) {
xhr.overrideMimeType("application/octet-stream;");
},
success : function(data) {
// do stuff with data
}
}).fail(function(xhr, status, error) {
// do stuff with error
});









share|improve this question

























  • This process may be repeated in a loop which is the reason for the synchronous ajax as the loop would need to be interrupted should the ajax call return an error of some kind. Huh? Asynchronous calls can be aborted and can have error callbacks.

    – Scott Marcus
    Nov 21 '18 at 20:00











  • Right, but as I indicate the ajax call must return its data before the loop is repeated. Not only that but the user has no idea what's happening because chrome is not allowing anything to display. The server-side process can take some time to complete so I need to show something otherwise he'll think it's frozen. Firefox doesn't do that. Anything I add to a div's innerHTML appears instantly.

    – Sam
    Nov 21 '18 at 22:18











  • So, don't use a loop at all. Use a regular asynchronous AJAX call and separate the loop code into its own function. Then, in the success callback, call the function that used to be the loop body. Then, the browser won't become unresponsive and you won't perform the next task until the previous one is done.

    – Scott Marcus
    Nov 22 '18 at 0:02











  • Good advice but it doesn't answer the main point of the question: why is chrome behaving differently from firefox? Is it due to buffering (I read somewhere that chrome buffers 1K before displaying) and if so how can that be overcome? I'd like an answer to that before I restructure my logic.

    – Sam
    Nov 22 '18 at 12:05














0












0








0








I have a situation where I am calling a js function when a button is clicked in a php page, a hidden dialog is displayed and some data is painted in the dialog prior to issuing a series of synchronous ajax calls which generate SQL statements server-side. This process may be repeated in a loop which is the reason for the synchronous ajax as the loop would need to be interrupted should the ajax call return an error of some kind.



My problem is that Chrome will not display the data prior to the ajax call whereas firefox will. I've tried setting the contentType method of the jqXHR Object to "application/octet-stream" but no luck.



Here's the ajax code:



 $.ajax({
async : false,
url : "url",
method : "GET", // redudntant, GET is the default
dataType : "text",
beforeSend : function(xhr) {
xhr.overrideMimeType("application/octet-stream;");
},
success : function(data) {
// do stuff with data
}
}).fail(function(xhr, status, error) {
// do stuff with error
});









share|improve this question
















I have a situation where I am calling a js function when a button is clicked in a php page, a hidden dialog is displayed and some data is painted in the dialog prior to issuing a series of synchronous ajax calls which generate SQL statements server-side. This process may be repeated in a loop which is the reason for the synchronous ajax as the loop would need to be interrupted should the ajax call return an error of some kind.



My problem is that Chrome will not display the data prior to the ajax call whereas firefox will. I've tried setting the contentType method of the jqXHR Object to "application/octet-stream" but no luck.



Here's the ajax code:



 $.ajax({
async : false,
url : "url",
method : "GET", // redudntant, GET is the default
dataType : "text",
beforeSend : function(xhr) {
xhr.overrideMimeType("application/octet-stream;");
},
success : function(data) {
// do stuff with data
}
}).fail(function(xhr, status, error) {
// do stuff with error
});






javascript ajax google-chrome firefox mime-types






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 8 at 15:52









Cœur

19.1k9114155




19.1k9114155










asked Nov 21 '18 at 19:50









SamSam

7114




7114













  • This process may be repeated in a loop which is the reason for the synchronous ajax as the loop would need to be interrupted should the ajax call return an error of some kind. Huh? Asynchronous calls can be aborted and can have error callbacks.

    – Scott Marcus
    Nov 21 '18 at 20:00











  • Right, but as I indicate the ajax call must return its data before the loop is repeated. Not only that but the user has no idea what's happening because chrome is not allowing anything to display. The server-side process can take some time to complete so I need to show something otherwise he'll think it's frozen. Firefox doesn't do that. Anything I add to a div's innerHTML appears instantly.

    – Sam
    Nov 21 '18 at 22:18











  • So, don't use a loop at all. Use a regular asynchronous AJAX call and separate the loop code into its own function. Then, in the success callback, call the function that used to be the loop body. Then, the browser won't become unresponsive and you won't perform the next task until the previous one is done.

    – Scott Marcus
    Nov 22 '18 at 0:02











  • Good advice but it doesn't answer the main point of the question: why is chrome behaving differently from firefox? Is it due to buffering (I read somewhere that chrome buffers 1K before displaying) and if so how can that be overcome? I'd like an answer to that before I restructure my logic.

    – Sam
    Nov 22 '18 at 12:05



















  • This process may be repeated in a loop which is the reason for the synchronous ajax as the loop would need to be interrupted should the ajax call return an error of some kind. Huh? Asynchronous calls can be aborted and can have error callbacks.

    – Scott Marcus
    Nov 21 '18 at 20:00











  • Right, but as I indicate the ajax call must return its data before the loop is repeated. Not only that but the user has no idea what's happening because chrome is not allowing anything to display. The server-side process can take some time to complete so I need to show something otherwise he'll think it's frozen. Firefox doesn't do that. Anything I add to a div's innerHTML appears instantly.

    – Sam
    Nov 21 '18 at 22:18











  • So, don't use a loop at all. Use a regular asynchronous AJAX call and separate the loop code into its own function. Then, in the success callback, call the function that used to be the loop body. Then, the browser won't become unresponsive and you won't perform the next task until the previous one is done.

    – Scott Marcus
    Nov 22 '18 at 0:02











  • Good advice but it doesn't answer the main point of the question: why is chrome behaving differently from firefox? Is it due to buffering (I read somewhere that chrome buffers 1K before displaying) and if so how can that be overcome? I'd like an answer to that before I restructure my logic.

    – Sam
    Nov 22 '18 at 12:05

















This process may be repeated in a loop which is the reason for the synchronous ajax as the loop would need to be interrupted should the ajax call return an error of some kind. Huh? Asynchronous calls can be aborted and can have error callbacks.

– Scott Marcus
Nov 21 '18 at 20:00





This process may be repeated in a loop which is the reason for the synchronous ajax as the loop would need to be interrupted should the ajax call return an error of some kind. Huh? Asynchronous calls can be aborted and can have error callbacks.

– Scott Marcus
Nov 21 '18 at 20:00













Right, but as I indicate the ajax call must return its data before the loop is repeated. Not only that but the user has no idea what's happening because chrome is not allowing anything to display. The server-side process can take some time to complete so I need to show something otherwise he'll think it's frozen. Firefox doesn't do that. Anything I add to a div's innerHTML appears instantly.

– Sam
Nov 21 '18 at 22:18





Right, but as I indicate the ajax call must return its data before the loop is repeated. Not only that but the user has no idea what's happening because chrome is not allowing anything to display. The server-side process can take some time to complete so I need to show something otherwise he'll think it's frozen. Firefox doesn't do that. Anything I add to a div's innerHTML appears instantly.

– Sam
Nov 21 '18 at 22:18













So, don't use a loop at all. Use a regular asynchronous AJAX call and separate the loop code into its own function. Then, in the success callback, call the function that used to be the loop body. Then, the browser won't become unresponsive and you won't perform the next task until the previous one is done.

– Scott Marcus
Nov 22 '18 at 0:02





So, don't use a loop at all. Use a regular asynchronous AJAX call and separate the loop code into its own function. Then, in the success callback, call the function that used to be the loop body. Then, the browser won't become unresponsive and you won't perform the next task until the previous one is done.

– Scott Marcus
Nov 22 '18 at 0:02













Good advice but it doesn't answer the main point of the question: why is chrome behaving differently from firefox? Is it due to buffering (I read somewhere that chrome buffers 1K before displaying) and if so how can that be overcome? I'd like an answer to that before I restructure my logic.

– Sam
Nov 22 '18 at 12:05





Good advice but it doesn't answer the main point of the question: why is chrome behaving differently from firefox? Is it due to buffering (I read somewhere that chrome buffers 1K before displaying) and if so how can that be overcome? I'd like an answer to that before I restructure my logic.

– Sam
Nov 22 '18 at 12:05












1 Answer
1






active

oldest

votes


















0














This is not so much an answer to my original question but given that nobody was able to answer it or even give me advice or point me in the right direction I reworked my code completely to eliminate client-side code with reliance on ajax for server-side processing. My solution relies almost entirely on server-side code with minimal client-side limited to messaging and informational visuals and no ajax. The fact that no solution was forthcoming from the community is a source of great disappointment as I've come to rely on stackoverflow for advice and examples. It begs the question: was it that nobody had the answer or that it was deemed answered?






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53419555%2fhow-to-keep-google-chrome-from-buffering%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    This is not so much an answer to my original question but given that nobody was able to answer it or even give me advice or point me in the right direction I reworked my code completely to eliminate client-side code with reliance on ajax for server-side processing. My solution relies almost entirely on server-side code with minimal client-side limited to messaging and informational visuals and no ajax. The fact that no solution was forthcoming from the community is a source of great disappointment as I've come to rely on stackoverflow for advice and examples. It begs the question: was it that nobody had the answer or that it was deemed answered?






    share|improve this answer




























      0














      This is not so much an answer to my original question but given that nobody was able to answer it or even give me advice or point me in the right direction I reworked my code completely to eliminate client-side code with reliance on ajax for server-side processing. My solution relies almost entirely on server-side code with minimal client-side limited to messaging and informational visuals and no ajax. The fact that no solution was forthcoming from the community is a source of great disappointment as I've come to rely on stackoverflow for advice and examples. It begs the question: was it that nobody had the answer or that it was deemed answered?






      share|improve this answer


























        0












        0








        0







        This is not so much an answer to my original question but given that nobody was able to answer it or even give me advice or point me in the right direction I reworked my code completely to eliminate client-side code with reliance on ajax for server-side processing. My solution relies almost entirely on server-side code with minimal client-side limited to messaging and informational visuals and no ajax. The fact that no solution was forthcoming from the community is a source of great disappointment as I've come to rely on stackoverflow for advice and examples. It begs the question: was it that nobody had the answer or that it was deemed answered?






        share|improve this answer













        This is not so much an answer to my original question but given that nobody was able to answer it or even give me advice or point me in the right direction I reworked my code completely to eliminate client-side code with reliance on ajax for server-side processing. My solution relies almost entirely on server-side code with minimal client-side limited to messaging and informational visuals and no ajax. The fact that no solution was forthcoming from the community is a source of great disappointment as I've come to rely on stackoverflow for advice and examples. It begs the question: was it that nobody had the answer or that it was deemed answered?







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 28 '18 at 15:07









        SamSam

        7114




        7114
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53419555%2fhow-to-keep-google-chrome-from-buffering%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Can I use Tabulator js library in my java Spring + Thymeleaf project?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents