Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

121
Vistas
is it safe to use ajax call every 5 second to check for new inserted database row

im working on a project using asp.net mvc. and im trying to read data from sql server every 5 second and update the user with some feedback.

what I've done till now is using ajax call combined with set timeout. so every 5 second use ajax call to check if there any new data as shown below.

( the URL is just an example)

  function ajaxRequest() {
  $.ajax({
    url: "https://jsonplaceholder.typicode.com/photos",
    success: function (result) {

      console.log(result);
 
    },
    complete: function (data) {},
  }).then(function () {

    setTimeout(ajaxRequest, 5000);
  });
}

my question is, is there any down side for using set timeout or set interval with ajax like this? or if there is any better solution for my problem.

worth to mention that the project will be used by at max 4 users at the same time. so I don't think over-loading the server with request will be a problem.

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda