Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8383105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:04:51+00:00 2026-06-09T17:04:51+00:00

I have auto request using jquery ajax, I am using this function for detection

  • 0

I have auto request using jquery ajax, I am using this function for detection new chat message & notification case. Sometimes I am thinking again what is the effect if client auto request without finish,

I am worried my server is down because i think this is like DDOS HTTP Throttling.

This is my code

    $(function(){
         initChat();
    });

    /* 
     * initialize chat system
     */
    function initChat() {
        setTimeout("notifChat()" ,2000);    
    }

    function notifChat() {
        $.ajax({
            url: '/url',
            type:"GET",
            data: {id:$("#id").val()},
            success:function (data,msg) {
                //to do success

            }
        });
        setTimeout("notifChat()" ,2000);
    }

My question is

  1. Is possible to down server or make server hung up ?
  2. If it is not better idea any somethink suggestion ?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:04:53+00:00Added an answer on June 9, 2026 at 5:04 pm

    Note: This is not production ready code, I have not tested it.

    A couple weekness of this code:

    It does not handle the two http connection limit

    strengths:

    it can tell if the server return an error (as in server error 404,403,402….)

    var failed_requests = 0;
    var max = 15;
    
    $(function(){
    
         initChat();
    });
    
    /* 
     * initialize chat system
     */
    function initChat()
    {
         setTimeout(
                 function() 
                 {
                    notifChat(); 
                 }, 2000)
    }
    
    
    function notifChat() {
        $.ajax({
            url: '/url',
            type:"GET",
            data: {id:$("#id").val()},
            success:function (data,msg) 
            {
                //to do success
    
            },
            complete: function()
            {
    
                // either call the function again, or do whatever else you want.
    
    
            },
            error: function(XMLHttpRequest, textStatus, errorThrown)
            {   
                failed_requests = failed_requests + 1;
    
                if(failed_requests  < max)
                {
                    setTimeout(
                             function() 
                             {
                                notifChat();
                             }, 2000)
                }
                else
                {  
                    alert('We messed up');
                }
    
            }
    
    
        });
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ajax script executed using jquery when an input text field is
I'm using django and jquery to implement authenticated sessions and Ajax requests. I have
I'm using jQuery AutoComplete, and I have an auto-complete search box to search for
Hey Guys. I have got a problem on using the jquery auto-complete plugin.my problem
I have been using mysql in a new rails application, but now I wanted
I have a new installation of Ubuntu 11.10 server with Tomcat6. I am using
I have an ASP.NET MVC 3 application with a auto-authorization using the client's windows
I have a jquery auto complete script that takes a JSON array and displays
I am trying to use the response from a jQuery ajax request to set
I have stolen/found/used/written and edited the following widget of jQuery for a auto-completing dropdown.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.