The problem of loading new content into a page area?

Discussion in 'Web Design' started by CoreCellar, Sep 3, 2017.

to remove all ads.
  1. CoreCellar

    CoreCellar New Member

    Messages:
    3
    How would you go about loading the content of menu items(basically new pages) into the empty area below the menu?

    So that the initial page and the menu itself is not loaded anew, but just the content linked from the menu items is loaded.
     
  2. chrishirst

    chrishirst Well-Known Member Staff Member

    Messages:
    2,639
  3. CoreCellar

    CoreCellar New Member

    Messages:
    3
    Yes, I already knew about that, but how do you change the content in a part of the page(below the menu), instead of the whole page?
     
  4. chrishirst

    chrishirst Well-Known Member Staff Member

    Messages:
    2,639
    You read the response data from the HTTP server request object and insert it into the HTML attribute of the content holder element

    If you had read down the page I linked to, you should have found a header labelled Function LoadDoc() which is the entire operation of retrieving and displaying the data.

    You simply need to replace "ajax_info.txt" with the URL of the document you want to display and change "demo" to the ID of YOUR content holder element.
     
  5. CoreCellar

    CoreCellar New Member

    Messages:
    3
    So, menu items would have to be transformed into buttons?
     
  6. chrishirst

    chrishirst Well-Known Member Staff Member

    Messages:
    2,639
    No, just use the 'onClick()' event handler of the link to trigger the request.

    Make sure the event is also set to return false so the anchor href attribute does not get called by the 'click' event.
     
  7. website7

    website7 New Member

    Messages:
    5
    Hi chrishirst, who are you??? because in that forum whar ever questions you are the answer that place , how you get the knowledge about all ???
     
  8. chrishirst

    chrishirst Well-Known Member Staff Member

    Messages:
    2,639
    I used to develop web stuff and desktop/server software for a living.
     
  9. Joniantrey

    Joniantrey New Member

    Messages:
    5
    As AJAX gives capability to load specific components like populating any field, fetching data from back end systems based on any event, it has been used to alleviate the load on network and allows faster web browsing as loading any specific items is less network intensive task rather loading an entire web page.
     

Share This Page