Home Web Front-end JS Tutorial Solve the problem of jquery asynchronously refreshing at a certain time interval_jquery

Solve the problem of jquery asynchronously refreshing at a certain time interval_jquery

May 16, 2016 pm 05:47 PM
Asynchronous refresh time interval

I want to refresh the pictures on a web page at a certain time interval without changing the name of the picture. I change the content of the picture on the server side. Can the front end achieve dynamic effects in this way? Does the browser have a cache?
For example, if I want to refresh the picture below asynchronously, what should I do?

Copy code The code is as follows:



The solution is to add a timestamp to prevent caching, as follows:
Copy code The code is as follows:



JScript code :
Copy code The code is as follows:

setInterval(function(){document.getElementById(' image').src='xxx.jpg?_dc=' new Date().getTime()},5000);//Update every 5s

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Use the time.Since function to calculate the time interval between the specified time and the current time, and format the output as a string Use the time.Since function to calculate the time interval between the specified time and the current time, and format the output as a string Jul 24, 2023 pm 03:57 PM

Use the time.Since function to calculate the time interval between the specified time and the current time, and format the output as a string. Time is an indispensable concept in human society. In computer programming, we often need to obtain and process time data. The time package in the Go language standard library provides a wealth of time operation functions, including the function of calculating time intervals. The time.Since function in Go language can be used to calculate the time interval between the specified time and the current time. Its function signature is as follows: funcSinc

How to set the time interval for saving file copies in Win10 How to set the time interval for saving file copies in Win10 How to set the time interval for saving file copies in Win10 How to set the time interval for saving file copies in Win10 Jun 25, 2024 pm 05:04 PM

Many friends often need to change various settings in the computer when using the win10 system to make it more in line with their own usage habits. Some friends want to change the save frequency of file copies through settings when using Win10 system, but they don’t know where to set it. Next, the editor will share with you how to set the time interval for saving file copies in Win10 system. . How to set the time interval for saving file copies in Win10 1. In the first step, after we click to open the computer, click on the "Start" button on the desktop, and then open the "Control Panel" option in the menu list. 2. In the second step, enter After the control panel page, we will then

How to use the Duration function for time interval operations in Java How to use the Duration function for time interval operations in Java Jun 26, 2023 pm 03:51 PM

In Java, we often need to perform time interval operations. Java provides a Duration class to handle the calculation of time intervals. The Duration class is one of the newly added time APIs in Java 8, which is used to calculate the time interval between two times. Next, let us learn how to use the Duration function for time interval operations. Create a Duration object. To use the Duration function in Java, you first need to create a Duration object.

Parse a string into a time interval using the time.ParseDuration function Parse a string into a time interval using the time.ParseDuration function Jul 24, 2023 am 09:05 AM

Use the time.ParseDuration function to parse a string into a time interval. Time is everywhere in our lives, and we often have to deal with time-related operations. The time package of the Go language provides many convenient functions and methods for processing time. One of the very useful functions is time.ParseDuration. The time.ParseDuration function can parse a string into a time interval. This function receives a string as parameter and returns a table

Use the time.ParseDuration function to parse a string into a time interval and return an error message Use the time.ParseDuration function to parse a string into a time interval and return an error message Jul 26, 2023 pm 07:02 PM

Use the time.ParseDuration function to parse a string into a time interval and return an error message. In the Go language, the time package provides many functions and tools for processing time and dates. One very useful function is the ParseDuration function, which parses a string into a time interval. The return value of the ParseDuration function consists of two parts: time interval and error information. If the string format is correct, a Durat representing the time interval will be returned.

Use the time.Since function to calculate the time interval between the specified time and the current time Use the time.Since function to calculate the time interval between the specified time and the current time Jul 24, 2023 am 08:57 AM

Using the time.Since function to calculate the time interval between a specified time and the current time is a valuable resource for each of us. In programming, we often need to calculate time intervals to perform some scheduled tasks or determine the execution time of certain operations. In Go language, we can use the Since function in the time package to calculate the time interval between the specified time and the current time. The time.Since function is defined as follows: funcSince(ttime.Time)time

Use the time.ParseDuration function to parse a string into a time interval and return the time and error information Use the time.ParseDuration function to parse a string into a time interval and return the time and error information Jul 25, 2023 am 08:41 AM

Use the time.ParseDuration function to parse a string into a time interval and return the time and error information. Time is everywhere in our lives, and for program development, processing time is an important task. In Go language, we can use the time package to handle time-related operations. The time.ParseDuration function is one of these methods, which parses a string into a time interval and returns the time and error information. time.ParseDura

Cache asynchronous refresh in Java caching technology Cache asynchronous refresh in Java caching technology Jun 20, 2023 am 09:34 AM

With the advent of the Internet era, data management and transmission have become increasingly important. For large-scale web applications, performance is a core factor, and one of the key factors is caching. Caching technology can greatly reduce web application response times and maintain site reliability during periods of high traffic. In Java caching technology, cache asynchronous refresh is a very important technology, which can ensure the timeliness of cached data while avoiding blocking user requests. This article will provide an in-depth introduction to cache asynchronous refresh in Java cache technology.

See all articles