Refreshing particular portion of the page using php

6 replies
Hello

I dont want to refresh whole page at time interval but iw ant to refresh particular part of the page using php. Is it possible?
#page #php #portion #refreshing
  • Profile picture of the author Andrew H
    yup, use some ajax.

    Let me google that for you
    Signature
    "You shouldn't come here and set yourself up as the resident wizard of oz."
    {{ DiscussionBoard.errors[8344317].message }}
    • Profile picture of the author skillboyz
      You can use div tag and javascript for this

      HTML Code:
      <div id="content"><p>refesh content</p></div>
      <a href="divrefresh()">Refresh</a>
      
      
      function divrefresh() {
           document.getElementById('content').innerHTML = "Div got refreshed"
      }
      You can even use ajax for this too
      {{ DiscussionBoard.errors[8344353].message }}
    • Profile picture of the author webprogramzone
      Originally Posted by Andrew H View Post

      yup, use some ajax.

      Let me google that for you
      Can you show me an example how can i do it using ajax?

      Thanks in advance for any help
      {{ DiscussionBoard.errors[8344998].message }}
      • Profile picture of the author Dr-Neo
        you can't do this .
        i mean if you need to refresh it will refresh the whole page for you not a div .
        but there are a few tricks to do this
        first setting up iframes and refreshing the included pages .
        or you may set an Ajax with a time interval .
        Signature
        {{ DiscussionBoard.errors[8346155].message }}
  • Profile picture of the author Andrew H
    @Dr-Neo -> you contradicted yourself in the post 'you can't do this' then 'you can do this with ajax'.

    For ajax refresh div there is this example: Simple Jquery Ajax Auto Refreshing DIV | Matthew A Price

    You need to be pulling the content from an external source (usually loading a php file). In the php file you would likely be querying the database or scraping from an external website.
    Signature
    "You shouldn't come here and set yourself up as the resident wizard of oz."
    {{ DiscussionBoard.errors[8346288].message }}
    • Profile picture of the author Dr-Neo
      Originally Posted by Andrew H View Post

      @Dr-Neo -> you contradicted yourself in the post 'you can't do this' then 'you can do this with ajax'.

      For ajax refresh div there is this example: Simple Jquery Ajax Auto Refreshing DIV | Matthew A Price

      You need to be pulling the content from an external source (usually loading a php file). In the php file you would likely be querying the database or scraping from an external website.
      i meant he can't refresh a piece of page and this is true .
      an Ajax call won't refresh the page it will only grab the information and then using JS it will update the div content but there will no refreshing
      Signature
      {{ DiscussionBoard.errors[8346304].message }}

Trending Topics