Forum Moderators: open

Message Too Old, No Replies

Question about ajax connecting to server.

         

Simone100

5:17 am on Dec 4, 2006 (gmt 0)

10+ Year Member



Hello, can ajax connect to the server for a server side script function only and not a page?

For instance if I want part of the main page to have a refresh without a full refresh every so often. There is a function on the server that executes another partial refresh after so much time. Can the ajax connect to the function so that the function applies to the http request? Thank you very much. Melanie

whoisgregg

11:12 pm on Dec 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Generally speaking, the server can't "push" a page update to the client. The nature of the web is that it's a "pull" technology.

What you can do is setup an AJAX call that polls a particular script on the server every n seconds (or even microseconds) to see if there is new content. If there is new content, than the callback function puts that content into the correct section of the page.

Most of the AJAX libraries out there have example files for how to do this as it's the backbone of using AJAX. :)

Simone100

7:40 am on Dec 5, 2006 (gmt 0)

10+ Year Member



Thanks Gregg, you're so smart!