How to use PHP to constantly refresh the content of a small div in the page

Source: Internet
Author: User
How to use PHP to constantly refresh the content of a small div in the page? Idea: When creating a business system, there is a small code at the top of the page after the salesperson charges: & lt; div & nbsp; id = 'Money' & gt; & lt ;? = Getmoney ($ _ SESSION [user_id])? & Gt; meta & lt;/div & gt; getmoney ($ How to use PHP to constantly refresh the content of a small div on the page?
Idea: When creating a business system, after the salesperson charges fees, there is a small piece of code at the top of the page:

 RMB



Getmoney ($ _ SESSION [user_id]) indicates that the user-defined function is used to retrieve the account currently logged on to the database, the receivables of the current day, $ _ SESSION [user_id]


It's a long journey.

How can we keep refreshing this small div without any assistance? Or is it automatically refreshed every one minute?

Prepare a "refresh" button and use ajax to refresh the data. What I want is to automatically refresh without interruption.

Answer questions.

------ Solution --------------------
Place an plug-in framework in it (iframe) and regularly refresh the page connected to it
------ Solution --------------------
Three methods: 1. ajax
2. put iframe on the top
3. use frameset, framework up and down, and refresh in top

------ Solution --------------------

function load()
{
$.ajax({
url:"xxx.php",
data:{"do":"load"},
success:function(d){
//$("#money").text("");
},
timeout:3000
});
}
setInterval(load,3000);


------ Solution --------------------
Reference:
Reference: setInterval is the js timer. in This timer, you can write ajax requests so that they are requested every other time. You can set the interval by yourself.

Can a cat help me write it down? This is what I want, but I won't write js ....

If you don't want to write js, use
Put it on the page once every 60 seconds and use iframe to introduce the page or the top page of the frame page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.