Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

How to refresh content within div in perl CGI ?

by chidori (Novice)
on Sep 23, 2014 at 16:36 UTC ( [id://1101679]=perlquestion: print w/replies, xml ) Need Help??

chidori has asked for the wisdom of the Perl Monks concerning the following question:

Hi

I have a CGI page where i want to refresh only a <div> . Actually I need to show information from database which constantly gets updated. And I am not sure how to refresh only a specific part of page and query the database each time and show the updated content.

Can someone please let me know how to do it?

Replies are listed 'Best First'.
Re: How to refresh content within div in perl CGI ?
by Your Mother (Archbishop) on Sep 23, 2014 at 16:40 UTC
Re: How to refresh content within div in perl CGI ?
by hardburn (Abbot) on Sep 23, 2014 at 16:45 UTC

    There's a way to do this without JavaScript: turn the <div> into a <iframe>. The iframe loads another CGI, which outputs just the updated data.

    It's probably better to go the JavaScript route, though.


    "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

      Thanks that sounds interesting. Will look into it.

        While it can work (sort of, in certain ways), please note well this part of the post: It's probably better to go the JavaScript route, though.

        Iframes come with their own problems and Ajax is not that hard.

Re: How to refresh content within div in perl CGI ?
by rnewsham (Curate) on Sep 24, 2014 at 07:16 UTC

    You can do this easily with the jquery load function. This loads the url and puts the content into the div. Full details and examples can be found in the documentation.

    $('#my_div').load('/my/url/to/load');
Re: How to refresh content within div in perl CGI ?
by Anonymous Monk on Sep 23, 2014 at 23:32 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1101679]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-03-29 05:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found