Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

How to refresh content within div in perl CGI ?

by chidori (Novice)
on Sep 23, 2014 at 16:36 UTC ( #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?

  • Comment on How to refresh content within div in perl CGI ?

Replies are listed 'Best First'.
Re: How to refresh content within div in perl CGI ?
by Your Mother (Bishop) 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 (Deacon) 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
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? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2019-10-15 03:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?