---
title: "how do you set interval to ajax call in jquery"  
description: "how do you set interval to ajax call in jquery"  
author: "Anonymous User"  
published: 2013-07-08  
updated: 2013-07-08  
canonical: https://www.mindstick.com/forum/1259/how-do-you-set-interval-to-ajax-call-in-jquery  
category: "javascript"  
tags: ["javascript"]  
reading_time: 1 minute  

---

# how do you set interval to ajax call in jquery

Hi [Developers](https://www.mindstick.com/articles/12875/blunders-you-must-avoid-while-hiring-java-developers-to-get-the-best-fulfilling-your-needs)!\
I need to create an ajax call every 5 [minutes](https://www.mindstick.com/articles/23598/best-wedding-photographer-inspire-the-best-to-protect-your-valuable-minutes). I have to below code. Can [someone tell me](https://www.mindstick.com/forum/34097/can-someone-tell-me-what-is-the-most-effective-optimization-on-page-optimization-or-off-page-optimization) how would I modify this code to run that ajax every 5 minutes?\
$([document](https://www.mindstick.com/articles/328642/what-to-consider-while-choosing-a-software-documentation-tool)).ready([function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server)() { var seriesOptions = [], yAxisOptions = [], [colors](https://answers.mindstick.com/qa/31019/should-i-paint-my-interior-with-neutral-or-bright-colors) = Highcharts.getOptions().colors; $.ajax({ url: 'echo_file.php', [datatype](https://www.mindstick.com/forum/160266/explain-the-datatype-data-annotation-and-its-significance-in-data-entry-and-display): 'json', [success](https://www.mindstick.com/articles/12957/best-tips-to-make-your-ghostwriting-experience-a-success): function([data](https://www.mindstick.com/articles/13050/salesforce-aiming-to-dominate-predictive-analytics-with-data-science)) { seriesOptions=data; createChart(); },\
[cache](https://www.mindstick.com/blog/222/clearing-cache-in-asp-dot-net): false });\
function createChart() { . . . }});

## Replies

### Reply by AVADHESH PATEL

Hi,\
try this\
$.ajax({url: "test.html",error: function(){ // will fire when timeout is reached},success: function(){ //do something},timeout: 3000 // sets timeout to 3 seconds});


---

Original Source: https://www.mindstick.com/forum/1259/how-do-you-set-interval-to-ajax-call-in-jquery

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
