Home Chrome freezing with simple ajax requests
Reply: 0

Chrome freezing with simple ajax requests

Pedro Jose Otero Rodriguez
1#
Pedro Jose Otero Rodriguez Published in 2018-01-13 03:02:37Z

I was developing my project in a simple web hosting (free) After it becomes more complex, i finally moved it to a paid hosting with SSL certificate. But a unexpected result now is the chrome browser freezin with ajax requests. I dont change a single line in the code, but after i moved it to the new hosting with SSL certificate, the navigator freezes VERY OFTEN, even sometimes becomes unclickable.

This is the ajax call (executed every 2 seconds)

function AutoRefresh(){

        $.ajax({

                url:   '/ajaxrefresh.php',
                type:  'post',
                beforeSend: function () {
                        $("#resultado").html("");
                },
                success:  function (response) {
                        $("#resultado").html(response);
                }
        });
}

If i stop the autorefresh the page never freeze. The file ajaxrefresh.php in the server makes a couple or cURL petitions before send the result, but it do not affects the result; i test stoping those cURL request and the browser still freezes. Finally i down the autorefresh stamp from 3 to 10 seconds (unusefull if it was the solution) and it do not works neither.

Also, the chrome debugger shows this: jquery.js:9625 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.

I never received that warning debugging before.

It is something about the SSL certificate? It is the only diference now, and the code was working great without it.

EDIT:

Im searching and working to fix this, since i need the ajax requests to be completely "on background" and im unable to do it.

I decided to test other projects where i used ajax requests. Im very surprised to find that they had many warnings and errors in the ajax request. In one where the ajax request only get some text, nithing especial, i get this from chrome debugger:

jquery.js:9625 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
send @ jquery.js:9625
ajax @ jquery.js:9215
jQuery._evalUrl @ jquery.js:9373
domManip @ jquery.js:5982
append @ jquery.js:5758
(anonymous) @ jquery.js:5884
jQuery.access @ jquery.js:4157
html @ jquery.js:5848
success @ funcionesjs.js:99
fire @ jquery.js:3148
fireWith @ jquery.js:3260
done @ jquery.js:9314
callback @ jquery.js:9718
XMLHttpRequest.send (async)
send @ jquery.js:9664
ajax @ jquery.js:9215
JsCompraBTC @ funcionesjs.js:91
onclick @ index.php:46
2VM31:22 Uncaught TypeError: Cannot read property 'addEventListener' of undefined
    at window.onclick (eval at <anonymous> (jquery.js:339), <anonymous>:22:47)
window.onclick @ VM31:22
3VM36:22 Uncaught TypeError: Cannot read property 'addEventListener' of undefined
    at window.onclick (eval at <anonymous> (eval at <anonymous> (jquery.js:339)), <anonymous>:22:47)
window.onclick @ VM36:22
2VM45:22 Uncaught TypeError: Cannot read property 'addEventListener' of undefined
    at window.onclick (eval at <anonymous> (eval at <anonymous> (eval at <anonymous> (eval at <anonymous> (jquery.js:339)))), <anonymous>:22:47)
window.onclick @ VM45:22

And this is the js function firing the ajax request:

function JsAdminusdt(){
        $.ajax({
                async: true,
                url:   '/ajaxutils/admindt.php',
                type:  'post',
                beforeSend: function () {
                        $("#resultado").html("");
                },
                success:  function (response) {
                        $("#resultado").html(response);
                }
        });

admindt.php contains plain html code to be shown in the resultado div.

Any suggestion here?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.298727 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO