ojek
ojek

Reputation: 10068

Two web applications in one browser window - one needs to be not refreshed, while second one is

I have a website, it's a normal website like stackoverflow etc. Now, I need to add a bottom strip to it, which will contain chat etc. I need this bottom strip not to refresh at all! So how can I do it, so that this bottom strip will act as a standalone web application (webapp inside of a webapp?)? I know about ajax requests, but when I have something like this:

<html>
 <head></head>
 <body>
    //somecode
    <div id="hereIsMyBottomStrip"></div>
 </body>
</html>

and I will call ajax request, then It will erase all the code on the page anyways. If I would call ajax to change only body part that is above my bottom strip, then it will paste whole new page in that section, and that would not compile. How can I solve my problem?

Upvotes: 0

Views: 91

Answers (2)

Greg Pettit
Greg Pettit

Reputation: 10830

Your structure will need an extra container is all:

<html>
 <head></head>
 <body>
    <div id="theRestOfThePage">
      //somecode
    </div>
    <div id="hereIsMyBottomStrip"></div>
 </body>
</html>

Then you fetch your content and replace only "theRestOfThePage".

Upvotes: 4

Jeffrey Blake
Jeffrey Blake

Reputation: 9709

In your ajax code, you are going to want to update the contents of another part of the page, rather than the whole body. Here's an example of one possible html structure, in which you would be using ajax to update the stuffToUpdate div:

<html>
 <head></head>
 <body>
    <div id="stuffToUpdate>
        //somecode
    </div>
    <div id="hereIsMyBottomStrip"></div>
 </body>
</html>

Upvotes: 1

Related Questions