I am working on a networking site where I need to reload the notification div every second. I wanted to know is it good or bad to load it every second as there are some other divs also loading after every 3-4 seconds. Will it cause any problem like hanging, slowing down, etc?

Reloading is done by ajax:

var auto_refresh = setInterval(
    function ()  {
        $('#notif').load('notiffinder.php #NOOFFNOTIFFC').fadeIn();
        $('#jtoloadnot').load('header.php #jtoloadnot').fadeIn();
    }, 1000);

closed as unclear what you're asking by Jim G., gnat, user40980, Kilian Foth, thorsten müller Jan 14 '14 at 15:50

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Basically you know that creating something cheap that consumes resources and has no value is not even considered useful for learning? – kagali-san Jan 12 '14 at 18:10

We can't tell you if it will cause problems because it entirely depends on what you are putting into that div, your internet connection, and what kind of load you have on the server.

But you need to ask yourself, do you really need to be polling multiple php scripts every second? Is the data actually changing every second? I suspect you probably should be investigating other techniques, such as websockets and long-polling.

  • thankyou for answering and guiding me ... i will be highly thankfull if you just give a brief about how to use webshockets please .. – user2561540 Jan 12 '14 at 1:26
  • I've not used websockets... but I'm sure there are many resources available online to get you started. – GrandmasterB Jan 12 '14 at 4:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.