How to append a content into div?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kaushal Elsner
    New Member
    • Jan 2011
    • 23

    How to append a content into div?

    I have actually used...
    document.getEle mentById('div_1 23').innerHTML += content;
    but sometimes a content added goes down & in place of that another content comes.

    example- if I add in a div_123 2 contents:
    1)abcde - very first time
    2)xyz - second time

    but sometimes div_123 displays:
    xyz
    abcde

    actually it should be like:
    abcde
    xyz

    Any idea?
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    where does the content to add come from? from different ajax-calls?

    kind regards

    Comment

    • Kaushal Elsner
      New Member
      • Jan 2011
      • 23

      #3
      ya from ajax. Actually the scenario is, I have different products lists. When i click on product, one div is generated in one parent(big) div. so as and when i click on products div's are getting generated. But the problem is sometimes the div generated before, comes down the order. I want the divs in first come first display order. Thanks.

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        ajax calls are async ... so it could be that the second call is faster then the first. you might create the divs in then correct order and append them to the parent-node and assign the response to the 'subdivs' after the response is received.

        Comment

        Working...