Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other How to use ajax?

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #167448
    Nishad
    Participant

    I have a product page on my website. There are two div’s on the page like product list on the left and its description on the right. When one of the hyperlink in the product list is clicked its description must come on the right div. How can i make this possible with ajax. Please help me.

    #167460
    Alen
    Participant

    Hope this helps: https://gist.github.com/alenabdula/9954542

    Make sure you are running local server if you’re trying to test this file, due to Cross-Site privacy settings.

    #167561
    Nishad
    Participant

    But I want to get the html when it is clicked on the same page in another div. Please help me.

    #167579
    Alen
    Participant

    But I want to get the html when it is clicked on the same page in another div. Please help me.

    That is what the above code does. It takes whatever pages are linked and loads them in the <div class="view"></div>

    <ul class="menu">
      <li><a href="product-one.html">Product One</a></li>
      <li><a href="product-two.html">Product Two</a></li>
      <li><a href="product-tri.html">Product Tri</a></li>
    </ul>

    When you click on the first link product-one.html that HTML document is loaded. Just create the document product-one.html and place the product description. The JavaScript takes whatever is in the href and loads that page via AJAX.

    I’ve commented the Gist I’ve linked to earlier, that might help.

    -Alen

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Other’ is closed to new topics and replies.