Either way you should wrap it in a $(document).ready, but you can put the
ajax call into it's own function and call in in the setInterval.

On 8/10/07, Steve Finkelstein <[EMAIL PROTECTED]> wrote:
>
> Benjamin,
>
> Thank you kindly again.
>
> One last inquiry. Do I pop that into a separate script? Possible just
> throw it inside of a $(document).ready() wrapper?
>
> On 8/10/07, Benjamin Sterling <[EMAIL PROTECTED]> wrote:
> >
> > Not entirely sure what you are saying but you can do something like:
> >
> > setInterval(function(){
> > $.ajax({
> >   type: "POST",
> >   url: "
> > some.php
> > ",
> >
> >   success: function(msg){
> >     $('myDiv).text(msg);
> >   }
> > });
> > }, 1000);
> >
> >
> >
> > On 8/10/07, Steve Finkelstein <[EMAIL PROTECTED] > wrote:
> > >
> > > Benjamin,
> > >
> > > I believe you understood properly, yes!
> > >
> > > I'm not sending the server any information, just receiving back
> > > information from a database which is influenced from other sources, not 
> > > this
> > > application. I'll have to lookup SetInterval syntax, thanks for the
> > > pointer.  Is it wise to try the excerpt you put below in a separate script
> > > to keep my XHTML clean and call it within the div somehow?
> > >
> > > Thanks again for your help.
> > >
> > > On 8/10/07, Benjamin Sterling < [EMAIL PROTECTED]>
> > > wrote:
> > > >
> > > > Steve,
> > > > You ultimately don't need to send params to the server side page,
> > > > you will just need to account for the returned information.
> > > >
> > > > $.ajax({
> > > >   type: "POST",
> > > >   url: "some.php",
> > > >
> > > >   success: function(msg){
> > > >     alert( "Data Saved: " + msg );
> > > >   }
> > > > });
> > > >
> > > > the success is where you would put your function to handle your
> > > > return information.
> > > >
> > > > Now, if this is something you want to do every X amount of minutes
> > > > or seconds, just put that in a setInterval function.
> > > >
> > > > Let me know if I understood you correctly.
> > > >
> > > > On 8/10/07, Steve Finkelstein < [EMAIL PROTECTED]> wrote:
> > > > >
> > > > >
> > > > > Hi all
> > > > >
> > > > > I'm looking to populate a div with information from a database ...
> > > > > don't want to pass any parameters to the serverside script, just
> > > > > want
> > > > > the div updated according to my query if the db record sets are
> > > > > modified, is .ajaxStart() the appropriate function for this?
> > > > >
> > > > > I'm basically looking to have the jquery poll the server every X
> > > > > seconds. Since HTTP is a connectionless protocol, I'm not entirely
> > > > > sure what the proper way would be to stop/start the request using
> > > > > good
> > > > > practices.
> > > > >
> > > > > In pseudo-type code it should work like this:
> > > > >
> > > > > User visits site.
> > > > >
> > > > > a request is made from the client to the server to invoke a
> > > > > function.
> > > > > a function on the server-side queries my mysql database with a
> > > > > simple
> > > > > query.
> > > > > the result set is returned as an array to the javascript object.
> > > > > the javascript object gets injected into the DOM.
> > > > >
> > > > > No parameters are passed in the ajax request to the server.
> > > > >
> > > > > thanks again for any insight folks.
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Benjamin Sterling
> > > > http://www.KenzoMedia.com
> > > > http://www.KenzoHosting.com
> > >
> > >
> > >
> >
> >
> > --
> > Benjamin Sterling
> > http://www.KenzoMedia.com
> > http://www.KenzoHosting.com
> >
>
>


-- 
Benjamin Sterling
http://www.KenzoMedia.com
http://www.KenzoHosting.com

Reply via email to