Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 8 of 8
  1. #1
    Member
    Join Date
    Feb 2004
    Posts
    76
    Member #
    4909
    Is there a way to refresh part of a page?

    What I am doing is making a 'now playing' feature on my web site. I have modified a java script. I have AIMP output the artist name, track title ect.. to a text file which then gets included in a java script. You can see it in action here.
    It will eventualy be included on the main page here.

    The problem I now have is that to automaticly update what is playing every minuite I will have to reload the whole page. I want to just refresh that script. Is there a way to do that? Is there anything taht will reload just the script that is included?

    I thought about using an iframe and just having the page in the iframe refresh every minuite, but decided against that for usability reasons.

    Is there anyway I can have the script reload the text file every X minuites? Or is there a way I can reload just part of the page? It will be going in it's own DIV if that helps.

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    If you reload the page that includes the JavaScript on it (which when launched I presume will be xvi32.net/index.php (or other extesnion)
    - reloading that will solve your issue.

    Code:
    <meta http-equiv="refresh" content="120">
    That will reload whichever page it is on in 2 minutes. (content is seconds).

    If you would like to reload only a part of the page, you would need a iframe/frame solution as far as I know.

    Good luck

  4. #3
    Member
    Join Date
    Feb 2004
    Posts
    76
    Member #
    4909
    Thanks I already know that, I don't want to reload the whole page. And I know about the iframes solution, re read my post...

  5. #4
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Hm, if you do a bit of editing, maybe.

    Lets say 2 files, main.php and scroller.php

    (main.php includes scroller.php)

    In scroller.php it includes the refresh tag from my previous post, that way only the output on main.php will be affected.

    Can you have server side includes?

  6. #5
    Senior Member audiofreak9's Avatar
    Join Date
    Apr 2005
    Location
    NJ
    Posts
    339
    Member #
    9584
    I think you may have to play with a script that will inquire for the variable(s) from something like a database every minute or so. What is causing the song to change? User or pre-defined? If it's the user then an onclick may be the answer. If predefined then a database variable may be the answer?

  7. #6
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    A lame but functional solution is to poll via Javascript for XML and convert that XML to markup, replacing existing markup on the page. It uses less markup.

    Real-time data is not meant for web pages given HTTP connections close as soon as they load their data.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  8. #7
    Senior Member
    Join Date
    Aug 2003
    Posts
    444
    Member #
    2801
    You can do this with server side push. The idea is fairly simple, but I've never implemented it. I will just give you tips from what I know, URLs to read, and a few starting points to consider. Beyond that, you're alone in one of the more arcane and darker sides of web programming

    Server side push works by using special HTTP headers; the one we want for our task is the "multipart/x-mixed-replace" content type. This tells the browsers that whatever is being sent down this channel would replace the previously sent content. For example, you can use this to make an animation where the IMG SRC is a script that sends several images down the HTTP connection. A neat and simple example at http://www.fortnet.org/FortNet/HTML/...ion/animation/ .

    Things to read before I go into a suggested solution:

    http://wp.netscape.com/assist/net_sites/pushpull.html

    http://www.web-developer-india.com/w...l/ch14_03.html

    http://xulplanet.com/tutorials/mozsdk/serverpush.php (this contains an example in PHP.)

    Suggested solution: Have a java script that writes the now playing song into the page. However, the script's source is a server-side script (PHP, perl, etc) that sends updated content.

    The mandatory google search
    http://www.google.com/search?hs=1r2&...sh&btnG=Search

    And one parting note: This probably won't work in all browsers...
    eKstreme
    eKstreme.com - Free website tools!
    fontfox - free fonts Hand-picked quality fonts.

  9. #8
    Senior Member Rince's Avatar
    Join Date
    Nov 2004
    Posts
    183
    Member #
    8318
    You could so something use Ajax. This is a javascript/php interface that lets you send recieve and display data from the server without having to reload the whole page. I've not coded anything in it yet but my wiki site uses an Ajax script for it's spell checker and also the search feature.
    http://www.adaptivepath.com/publicat...ves/000385.php
    http://en.wikipedia.org/wiki/AJAX

    Other than that, it would have to be the iframe option. Though frames are generally bad, it could be justified in this case since only a small amount of the page content is going to be inside the frame, so the accessability issue are limited to that small amount of content only.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:21 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com