Hopefully someone out there can help me out with this.

I'm trying to figure out a method to update content on a page without refreshing it.

This can't be accomplished via Javascript since it'd need to update itself with content from a database.

I've seen ASP pages that accomplish this, but I'm unsure how ASP actually does this.
i.e. if it has a persistent connection to the web server, or other method.

Thanks ahead of time for any suggestions or help.

Fred

    I think the asp page(update content with out refreshing) use ActiveX or something like that(java applet, inner frame ...).

      you could use ActiveX or JavaApplets or something like that, but I think the easiest way to do it is using javascript (to renew (read refresh :o) your content and php (for the database part) together.

      document.location.href='<? echo $PHP_SELF; ?>';

        The easy way is simple meta tag <META HTTP-EQUIV=\"refresh\" CONTENT=\"30\"; >

        Content is time of refreshing in seconds

          A page can't reload it's content without refreshing itself unlsee like it has bee said something else is doing the refreshing such as java.

          Perhaps it was another frame that was doing the refreshing on the page you saw?

          Also, it could have been delaying it's output...asp has some kind of flush command where it can display all data that it has found from a query whilst it is still doing some querying.

          cheers,
          scottd

            So then how would I do this:

            A form has 3 sections.
            One main one and 2 sub ones that are dependant on the main one.

            If I choose option 1 in the main section I want the first sub section to show up.
            And if I choose option 2 in the main section I want the second sub section to show up.

            Now each of these sub sections has PHP code in it to populate fields.

            Is there any way with or without Javascript to accomplish this without a page refresh?

            If not, no biggie - it'd just be nice to be able to do.

            • Fred

              You have 3 options.

              Option 1: use frames and have the top frame load frame 2 or 3 depending on the result of frame 1. To submit all the data from frame 1 and frame 2 or 3 to another oage simply have frames 2 and 3 store frame1 vars as hidden inputs.

              Confused?

              Option 2: If you are not worrying about Netscape...have the second and third parts in the papge ready, but hide their visiblity using style="diplay:none;" or style="visibility:hidden;" depending on what way youy want to do it. When the user selects an iotiuon in part 1 simpke use javascript to 'show' the appropriate part of the form...2 or 3.

              Option 3:

              If pars 2 and 3 are similar ie: they are bothe select fields of something then store ALL the data from php as arrays in javascript. Once the user selects something in part 1 you simply have javascript populate the select field with the appropriate data.

              I am betting that it is option 3 that you have seen. It is often used on car search forms where you first select a make...then another select field populates itself with the available models of that make.

              easy peasy.

              good luck.
              scottd

                Frames, as user-hostile as they can sometimes be, could end up being your best option here. Options 2 and 3, while they avoid frames, often prove to be impractical when working with large data sets, as it becomes pretty prohibitive to (e.g.) load all the data for all the models for all the manufacturers a large retail site may sell.

                  it doesn't use ASP it uses embedded Visual Basic script, basic the page is a small VB type program, you muse at MS vitural machine installed thus, Netscape users... are SOL!

                    Write a Reply...